|Subject:||Re: OutofTree Block C++ problem|
|Date:||Mon, 15 Nov 2021 13:18:35 -0700|
have a look at the header file here: https://github.com/gnuradio/gnuradio/blob/eb91fb04b3d0ca8124b9bea375e3bf72963fa172/gnuradio-runtime/include/gnuradio/random.h61| double X = gr::random(0,0,2) | ^~~~~~~~~~~ | gr::random
you are calling the constructor of gr::random here, which does not return anything.
Instead you need to assign it something and then query it for random numbers
gr::random foo = gr::random(0,0,2);int i = foo.ran_int(); // .. you can then do it again of course int j = foo.ran_int();
you seem to be wanting a double, where you have to check which distribution you want (see the header file).
One example could bedouble d = static_cast<double>(foo.gasdev());
which will, if I looked right, give you a float in the range of -1 and 1. To get it in range 0 to 2, you can just add 1.0 to it.
[my mail program/me took the wrong mail address when replying to the digest, therefore answer delayed a bit]
|[Prev in Thread]||Current Thread||[Next in Thread]|