AntSimulator icon indicating copy to clipboard operation
AntSimulator copied to clipboard

Random Number Generator does not work

Open marcoperic opened this issue 3 years ago • 4 comments

Hi

It seems like RNG<> does not generate random numbers in succession. Even after restarting my instance, I still get the same number.

marcoperic avatar Mar 03 '22 07:03 marcoperic

Thank you for the report, I will look into this

johnBuffer avatar Mar 03 '22 12:03 johnBuffer

Can you provide a minimal code showing how you are using it ?

johnBuffer avatar Mar 03 '22 16:03 johnBuffer

Can you provide a minimal code showing how you are using it ?

I borrowed some of your code from the color_picker.hpp class and got similar results. RNGf::getUnder(255.0f) , after running in main() as a test, returned the same value across different instances, 192.88. I am accessing RNG<> via #include "common/number_generator.hpp"

Edit: I just saw that you called RNG::initialize() in main()... I never did this. Would this be the cause of my problem?

Regards, Marco

marcoperic avatar Mar 03 '22 21:03 marcoperic

This initialize is a new addition to ensure that the static attribute of the RNG object is correctly created before any use but I am not sure this will solve the issue you have. I will do some tests this afternoon

johnBuffer avatar Mar 04 '22 11:03 johnBuffer