From b4650e040c1d06fe69b5da9ac041d68793ce14a0 Mon Sep 17 00:00:00 2001 From: Benjamin BOUVIER Date: Fri, 7 Sep 2012 11:04:12 -0400 Subject: [PATCH] MPI Distrib exp: use of eoRng instead of eoUniformGenerator --- eo/test/mpi/t-mpi-distrib-exp.cpp | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/eo/test/mpi/t-mpi-distrib-exp.cpp b/eo/test/mpi/t-mpi-distrib-exp.cpp index dadef89ee..72e934e52 100644 --- a/eo/test/mpi/t-mpi-distrib-exp.cpp +++ b/eo/test/mpi/t-mpi-distrib-exp.cpp @@ -111,42 +111,23 @@ class NormalDistribution : public Distribution // empty } - ~NormalDistribution() - { - if( _rng ) - { - delete _rng; - } - } - void make_parser( eoParser & parser ) { _active = parser.createParam( false, "normal", "Normal distribution", '\0', "Normal").value(); _mean = parser.createParam( 0.0, "normal-mean", "Mean for the normal distribution (0 by default), in ms.", '\0', "Normal").value(); - double _stddev = parser.createParam( 1.0, "normal-stddev", "Standard deviation for the normal distribution (1ms by default), 0 isn't acceptable.", '\0', "Normal").value(); - - if( _active ) - { - _rng = new eoNormalGenerator( _stddev ); - } + _stddev = parser.createParam( 1.0, "normal-stddev", "Standard deviation for the normal distribution (1ms by default), 0 isn't acceptable.", '\0', "Normal").value(); } int next_element() { - int next = std::floor( _mean + (*_rng)() ); - if( next < 0 ) - { - next = 0; - } - return next; + return std::floor( _rng.normal( _mean, _stddev ) ); } protected: - eoNormalGenerator * _rng; - + eoRng _rng; double _mean; - + double _stddev; } normalDistribution; int main( int argc, char** argv )