fix: add template to eoBooleanGenerator
In order to be able to generate boolean within int types.
This commit is contained in:
parent
da4118142f
commit
3d6821a97c
1 changed files with 8 additions and 7 deletions
|
|
@ -115,15 +115,16 @@ inline bool eoUniformGenerator<bool>::operator()(void)
|
|||
to easily generate random booleans with a specified bias
|
||||
\ingroup bitstring
|
||||
*/
|
||||
class eoBooleanGenerator : public eoRndGenerator<bool>
|
||||
template<class T=bool>
|
||||
class eoBooleanGenerator : public eoRndGenerator<T>
|
||||
{
|
||||
public :
|
||||
eoBooleanGenerator(float _bias = 0.5, eoRng& _rng = rng) : bias(_bias), gen(_rng) {}
|
||||
public :
|
||||
eoBooleanGenerator(float _bias = 0.5, eoRng& _rng = rng) : bias(_bias), gen(_rng) {}
|
||||
|
||||
bool operator()(void) { return gen.flip(bias); }
|
||||
private :
|
||||
float bias;
|
||||
eoRng& gen;
|
||||
T operator()(void) { return gen.flip(bias); }
|
||||
private :
|
||||
float bias;
|
||||
eoRng& gen;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue