EvolvingObjects
|
The class eoUniform can be used in the STL generate function to easily generate random floats and doubles. More...
#include <eoRndGenerators.h>
Public Member Functions | |
eoUniformGenerator (T _max=T(1.0), eoRng &_rng=rng) | |
eoUniformGenerator (T _min, T _max, eoRng &_rng=rng) | |
T | operator() (void) |
Generates the number, uses a static_cast to get the right behaviour for ints and unsigneds. | |
template<> | |
bool | operator() (void) |
The pure virtual function that needs to be implemented by the subclass. | |
Private Attributes | |
T | minim |
T | range |
eoRng & | uniform |
The class eoUniform can be used in the STL generate function to easily generate random floats and doubles.
It can also be used for ints and unsigneds by virtue of the static_cast in the generator function.
Also present is a specialization for boolean, that will ignore the minima and maxima that are possibly set and will return an unbiased flip of a coin. For a biased flip, use the eoBoolean
either in [0, _max) if only 1 value (_max) is given (or none, as _max defaults to 1.0) or in [_min,_max) if 2 values are given (_min, _max)
Definition at line 72 of file eoRndGenerators.h.