EvolvingObjects

The class eoUniformInit can be used in the STL apply function to easily randomize floats and doubles. More...
#include <eoUniformInit.h>
Public Member Functions  
eoUniformInit (T _max=T(1.0), eoRng &_rng=rng)  
Ctor with only a max bound.  
eoUniformInit (eoRealBounds &_bound, eoRng &_rng=rng)  
Ctor with an eoRealBound.  
eoUniformInit (T _min, T _max, eoRng &_rng=rng)  
Ctor with explicit min and max.  
void  operator() (T &_t) 
Generates the number, uses a static_cast to get the right behaviour for ints and unsigneds.  
template<>  
void  operator() (bool &_b) 
Private Attributes  
T  minim 
T  range 
eoRng &  uniform 
The class eoUniformInit can be used in the STL apply function to easily randomize floats and doubles.
Copied from the eoRndGenerators to have objects deriving from eoInit As the whole initialization mechanism in EO is based on eoInit rather than eoRndGenerators, we might as well have these directly written without overhead.
It can also be used for ints and unsigneds by virtue of the static_cast
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)
for doubles, floats, ints, ...
Definition at line 67 of file eoUniformInit.h.