I want to randomly select an integer among n numbers, where n is small (say 5). To do this, I am using std::uniform_int_distribution
.
The exact details of the distribution are not that important, but I want the results to be random and to use all the integers in the range. The randomized selection will be done many more times that the length (size) of the range. I want to the choice to be done quickly and randomly.
But, no matter how many times I run it, I receive the same output. In an attempt to get different output, I let some minutes to pass and then tried again: the result was still the same (probably this code is not affected by time).
Is it expected that each time I use uniform_int_distribution
that I will get the same output?
As uniform_int_distribution
in particular is not what I need (I just need random numbers), I tried with RandomUniform from my pseudosite. While I got different results than std::uniform_int_distribution
produced, when I ran it again it produced the same numbers each time. Of course, I used the same main.
I didn't post RandomUniform, in order to not make the post any bigger.