Random number generators discussion

Random number generators | www.agner.org

Meaning of period = 2^19937-1
Author: Agner Date: 2006-03-23 07:44
You are confusing the resolution and the period. The resolution is the number of different values that the function can generate. The period is the number of calls to the function before the whole sequence repeats.

Take as an example a very simple random number generator producing a 2-bit output. The resolution is 2^2 = 4. Assume that the output looks like this:

3-1-0-2 - 3-1-0-2 - 3-1-0-2 - 3-1-0-2 - 3-1-0-2 - 3-1-0-2 - ...

Here the resolution is 4 and the period is 4. We are not satisfied with knowing that after a 3 always follows a 1. That is not sufficiently random. So we make a better generator that makes the output:

3-1-0-2-0-3-3-2-1-1-1-2-0-3-2-0 - 3-1-0-2-0-3-3-2-1-1-1-2-0-3-2-0 - 3-1-0-2-0-3-3-2-1-1-1-2-0-3-2-0 - ...

This has a resolution of 4 but a period of 16.

 
thread Meaning of period = 2^19937-1 new - Ngo Minh Toan - 2006-03-22
last reply Meaning of period = 2^19937-1 - Agner - 2006-03-23