Changed the general operator interface to be consistent with the rest
of EO, updated some documentation.
This commit is contained in:
parent
64a5d2de58
commit
ed45375451
17 changed files with 230 additions and 52 deletions
|
|
@ -66,6 +66,29 @@ class eoUniform: public eoRnd<T>
|
|||
double diff;
|
||||
};
|
||||
|
||||
template<>
|
||||
class eoUniform<bool>: public eoRnd<bool>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Default constructor.
|
||||
* @param _min The minimum value in the interval.
|
||||
* @param _max The maximum value in the interval.
|
||||
*/
|
||||
eoUniform(bool _min = false, bool _max = true)
|
||||
: eoRnd<bool>() {}
|
||||
|
||||
/** Returns an uniform random number over the interval [min, max)
|
||||
Uses global rng object */
|
||||
virtual bool operator()() {
|
||||
return rng.flip(0.5);
|
||||
}
|
||||
|
||||
private:
|
||||
T min;
|
||||
double diff;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue