Non repeating random number generation with x(i+1) = x(i) + increment mod m

1.9k Views Asked by At

I have to generate millions of non-repeating random numbers and came across this equation: $x_{i+1} = x_i+c \space(mod \ m)$, where c and m are relative primes and $m \geq total\ to\ be\ generated$.

This works ok since I don't need good random numbers and don't have to memorize them. My question is, what is the demonstration and name of this method? I will have to write about it, but can't find any information not knowing how to formulate my question.

2

There are 2 best solutions below

0
On BEST ANSWER

Your method is called a "linear congruential generator".

Please have also a look at this question:

how to generate real random numbers

The linear congruential generators are commonly considered to be a bad choice, with much better algorithms available, but it will depend on your application which generator turns out to be good or bad.

0
On