Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fastnoise_source uses non thread-safe rand() function #1542

Closed
mgw93 opened this issue Dec 20, 2017 · 0 comments
Closed

fastnoise_source uses non thread-safe rand() function #1542

mgw93 opened this issue Dec 20, 2017 · 0 comments
Labels

Comments

@mgw93
Copy link

mgw93 commented Dec 20, 2017

The fast noise source block uses the rand() function to sample the precalculated values.
As rand() is not thread safe, this leads to non-reproducible behaviour.
Also, the specified seed value is not used with srand.
It might be better to use the random number functions in boost or in C++11.

To easily show this behaviour, connect two fast noise sources with the same seed to a subtract block and plot the output.

marcusmueller added a commit to marcusmueller/gnuradio that referenced this issue Jan 27, 2018
Closes gnuradio#1542.

Also, replaces the pool generation based on gr::random by RV generated
by the same XOROSHIRO128+ RNG used to calculate the random pool indices.
If it's good enough, it's good enough – and all statistical tests I can
come up with so far say it is good enough.
marcusmueller added a commit to marcusmueller/gnuradio that referenced this issue Jan 27, 2018
Closes gnuradio#1542.

Also, replaces the pool generation based on gr::random by RV generated
by the same XOROSHIRO128+ RNG used to calculate the random pool indices.
If it's good enough, it's good enough – and all statistical tests I can
come up with so far say it is good enough.
@mbr0wn mbr0wn added the Bug label Feb 4, 2018
marcusmueller added a commit to marcusmueller/gnuradio that referenced this issue Feb 16, 2018
This solves the issue with libc rand() relying on global
(not thread-local!) state and thus not being suited for multithreaded
applications. This fixes gnuradio#1542.
marcusmueller added a commit that referenced this issue Mar 4, 2018
This solves the issue with libc rand() relying on global
(not thread-local!) state and thus not being suited for multithreaded
applications. This fixes #1542.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants