Index: ../trunk-jpl/src/c/shared/Random/randomgenerator.cpp =================================================================== --- ../trunk-jpl/src/c/shared/Random/randomgenerator.cpp (revision 26586) +++ ../trunk-jpl/src/c/shared/Random/randomgenerator.cpp (revision 26587) @@ -4,3 +4,46 @@ #include #include "./randomgenerator.h" + +rnd_uniform_distribution::rnd_uniform_distribution() +{/*{{{*/ + + a = 1103515245; // BSD Formula + c = 12345; // BSD Formula + m = 2147483648; // BSD Formula + _seed = 0; + lbound = 0.0; + ubound = 1.0; + return; +} +/*}}}*/ +rnd_uniform_distribution::rnd_uniform_distribution(double lower,double upper){/*{{{*/ + + a = 1103515245; // BSD Formula + c = 12345; // BSD Formula + m = 2147483648; // BSD Formula + _seed = 0; + lbound = lower; + ubound = upper; + return; +} +/*}}}*/ +rnd_uniform_distribution::~rnd_uniform_distribution(){} + +rnd_normal_distribution::rnd_normal_distribution(){/*{{{*/ + + _seed = 0; + mean = 0; + sdev = 1.0; + return; +} +/*}}}*/ +rnd_normal_distribution::rnd_normal_distribution(double m,double s){/*{{{*/ + + _seed = 0; + mean = m; + sdev = s; + return; +} +/*}}}*/ +rnd_normal_distribution::~rnd_normal_distribution(){} Index: ../trunk-jpl/src/c/shared/Random/randomgenerator.h =================================================================== --- ../trunk-jpl/src/c/shared/Random/randomgenerator.h (revision 26586) +++ ../trunk-jpl/src/c/shared/Random/randomgenerator.h (revision 26587) @@ -16,17 +16,21 @@ int c; unsigned int m; unsigned _seed; - double a1; - double a2; + double lbound; + double ubound; int drnd() { return( _seed = ( a * _seed + c ) % m ); } public: - rnd_uniform_distribution() : _seed( 0 ), a( 1103515245 ), c( 12345 ), m( 2147483648 ), a1(0.0), a2(1.0) {} - rnd_uniform_distribution(double a_1,double a_2) : _seed( 0 ), a( 1103515245 ), c( 12345 ), m( 2147483648 ), a1(a_1), a2(a_2) {} + + /*constructors, destructors: */ + rnd_uniform_distribution(); + rnd_uniform_distribution(double a_1,double a_2); + ~rnd_uniform_distribution(); + void seed( unsigned int s ) { _seed = s; } unsigned int get_seed() { return _seed; } - double generator() { return (a2-a1)*(double) drnd()/ m + a1; } + double generator() { return (ubound-lbound)*(double) drnd()/ m + lbound; } }; @@ -39,8 +43,12 @@ double sdev; public: - rnd_normal_distribution() : _seed( 0 ), mean( 0), sdev(1.0) {} - rnd_normal_distribution(double m,double s) : _seed( 0 ), mean( m ), sdev(s) {} + + /*constructors, destructors: */ + rnd_normal_distribution(); + rnd_normal_distribution(double m,double s); + ~rnd_normal_distribution(); + void seed( unsigned int s ) { _seed = s; } double generator() {