summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib/math
diff options
context:
space:
mode:
authorAndrej Rode <mail@andrejro.de>2018-03-19 23:19:02 +0100
committerMarcus Müller <marcus.mueller@ettus.com>2018-03-30 16:51:31 +0200
commit5f455396abe7da2ec96300c7b1ee31748f138752 (patch)
treebeebddd5fbb755db3231dc84b83bb725621d4789 /gnuradio-runtime/lib/math
parent8ca68d846ba9e07ec1c43f106ebcedfdbeb46c91 (diff)
analog: remove std::time(0) seed from gr::random if 0 is selected
Instead the default seed implemented in boost::random is used by calling seed() without arguments
Diffstat (limited to 'gnuradio-runtime/lib/math')
-rw-r--r--gnuradio-runtime/lib/math/random.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/gnuradio-runtime/lib/math/random.cc b/gnuradio-runtime/lib/math/random.cc
index 401ba89735..af90a33429 100644
--- a/gnuradio-runtime/lib/math/random.cc
+++ b/gnuradio-runtime/lib/math/random.cc
@@ -73,9 +73,12 @@ namespace gr {
void
random::reseed(unsigned int seed)
{
- if(seed==0) d_seed = static_cast<unsigned int>(std::time(0));
- else d_seed = seed;
- d_rng->seed(d_seed);
+ d_seed = seed;
+ if (d_seed == 0){
+ d_rng->seed();
+ } else {
+ d_rng->seed(d_seed);
+ }
// reinstantiate generators. Otherwise reseed doesn't take effect.
delete d_generator;
d_generator = new boost::variate_generator<boost::mt19937&, boost::uniform_real<float> > (*d_rng,*d_uniform); // create number generator in [0,1) from boost.random