diff --git a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc index 3cd4c92d9..bfb1eb48a 100644 --- a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc +++ b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc @@ -133,8 +133,8 @@ void signal_generator_c::init() } } } - random_ = new gr::random(); std::default_random_engine e1(r()); + std::default_random_engine e2(r()); std::uniform_int_distribution uniform_dist(0, RAND_MAX); } @@ -271,7 +271,6 @@ signal_generator_c::~signal_generator_c() } } */ volk_gnsssdr_free(complex_phase_); - delete random_; } @@ -433,7 +432,7 @@ int signal_generator_c::general_work(int noutput_items __attribute__((unused)), { for (out_idx = 0; out_idx < vector_length_; out_idx++) { - out[out_idx] += gr_complex(random_->gasdev(), random_->gasdev()); + out[out_idx] += gr_complex(normal_dist(e1), normal_dist(e2)); } } diff --git a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.h b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.h index c01b6c8e0..1dce88924 100644 --- a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.h +++ b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.h @@ -33,7 +33,7 @@ #include "gnss_signal.h" #include -#include +//#include #include #include #include @@ -120,13 +120,15 @@ private: boost::scoped_array sampled_code_data_; boost::scoped_array sampled_code_pilot_; - gr::random *random_; + //gr::random *random_; gr_complex *complex_phase_; unsigned int work_counter_; std::random_device r; std::default_random_engine e1; + std::default_random_engine e2; std::uniform_int_distribution uniform_dist; + std::normal_distribution normal_dist; public: ~signal_generator_c(); // public destructor