Added new RNG and test files for it
This commit is contained in:
parent
18f6c31513
commit
46b6a9e17a
11 changed files with 561 additions and 35 deletions
|
|
@ -27,12 +27,10 @@
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <eoRnd.h> // for base class
|
||||
#include <eoRNG.h> // for base class
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Class eoNegExp
|
||||
|
|
@ -56,7 +54,8 @@ class eoNegExp: public eoRnd<T>
|
|||
eoNegExp( const eoNegExp& _rnd): eoRnd<T>( _rnd), mean(_rnd.mean) {};
|
||||
|
||||
/// Returns an uniform dandom number over the interval [min, max).
|
||||
virtual T operator()() { return - mean*log((double)rand() / RAND_MAX); }
|
||||
virtual T operator()() {
|
||||
return T( -mean*log((double)rng.rand() / rng.rand_max())); }
|
||||
|
||||
private:
|
||||
T mean;
|
||||
|
|
|
|||
Reference in a new issue