Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Is qrand() guaranteed to generate the same sequence with same seed across different platforms?
utcenter last edited by
I need to generate pseudo random data for benchmarking purposes, so in order to have uniformity of the results across different platforms I need to be able to generate the same random data. So the big question is, will qrand() generate the same pseudo random sequences on different platforms if the seed is the same?
QtRoS last edited by
Your question must be "will srand() generate the same pseudo random sequences on different platforms if the seed is the same", because qrand realized through srand, but guarantees thread-safety. And you can easily test it by hand. I think the answer in no.
My opinion - you must use once generated sequence.
DerManu last edited by
Why not save the time worrying about it and just write a pseudo random number generator yourself in 10 seconds? Then you know what you've got and for benchmarking you probably don't need high quality random numbers.
@r = (r*1103515245+12345) & max;@