mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 14:49:53 +08:00
Added license and comments.
This commit is contained in:
parent
0d86ea39c9
commit
525bdef691
@ -56,10 +56,12 @@ namespace etl
|
||||
{
|
||||
//***************************************************************************
|
||||
/// Default constructor.
|
||||
/// Attempts to come up with a reasonable non-zero seed.
|
||||
//***************************************************************************
|
||||
random::random()
|
||||
{
|
||||
// An attempt to come up with a reasonable non-zero seed.
|
||||
// An attempt to come up with a reasonable non-zero seed,
|
||||
// based on the address of the instance.
|
||||
uintptr_t n = reinterpret_cast<uintptr_t>(this);
|
||||
uint32_t seed = static_cast<uint32_t>(n);
|
||||
initialise(seed);
|
||||
@ -67,6 +69,7 @@ namespace etl
|
||||
|
||||
//***************************************************************************
|
||||
/// Constructor with seed value.
|
||||
///\param seed The new seed value.
|
||||
//***************************************************************************
|
||||
random::random(uint32_t seed)
|
||||
{
|
||||
@ -100,6 +103,7 @@ namespace etl
|
||||
|
||||
//***************************************************************************
|
||||
/// Initialises the sequence with a new seed value.
|
||||
///\param seed The new seed value.
|
||||
//***************************************************************************
|
||||
void random::initialize(uint32_t seed)
|
||||
{
|
||||
|
||||
33
src/random.h
33
src/random.h
@ -1,6 +1,35 @@
|
||||
///\file
|
||||
|
||||
#ifndef __ETL_RANDOM_INCLUDED_
|
||||
#define __ETL_RANDOM_INCLUDED_
|
||||
/******************************************************************************
|
||||
The MIT License(MIT)
|
||||
|
||||
Embedded Template Library.
|
||||
https://github.com/ETLCPP/etl
|
||||
http://www.etlcpp.com
|
||||
|
||||
Copyright(c) 2017 jwellbelove
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files(the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions :
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __ETL_RANDOM__
|
||||
#define __ETL_RANDOM__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user