diff --git a/src/random.cpp b/src/random.cpp index fbe1ba15..5b7eca34 100644 --- a/src/random.cpp +++ b/src/random.cpp @@ -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(this); uint32_t seed = static_cast(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) { diff --git a/src/random.h b/src/random.h index c6ba60e4..e8ba5423 100644 --- a/src/random.h +++ b/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