To be clear: the random number generators themselves are indicated quite strongly - including input parameters and results. To be technical, what is indicated is the result of 10,000 th from the generator, built by default, but for any practical purpose, the coincidence of this result from the generator is at least reasonably close to the rule, otherwise it substantially guarantees that the generator works correctly. and its outputs will match any other similar generator for a given seed.
For example, a quick test:
#include <random> #include <iostream> int main() { std::mt19937 r; for (int i=0; i<10000-2; i++) r(); for (int i=0; i<3; i++) std::cout << r() << "\n"; }
... shows the same results with each (last) compiler, which is convenient for me:
1211010839 4123659995 725333953
The second of these three values ββis the value required by the standard.
However, distribution templates give additional freedom. A uniform_int_distribution should uniformly map inputs to outputs, but there are different ways to do this, and there is no requirement on which of these methods to use.
If you really need to create a sequence of integers within a range that is not only evenly distributed but also consistent across implementations, you will probably have to implement your own distribution code. Doing it well is not as trivial as most people think. Maybe you should take a look at one of my previous answers for a working implementation, as well as some explanation and some test code.
source share