2 Random numbers

Index - - Contents - - Previous chapter - Next chapter - - Previous page - Next page

2.4 The multiplicative congruential method

The multiplicative congruential random number generator is defined by
        Xi = aXi-1 (mod m)
Illustration: Let a be 3 and m=102. X (mod 100) is the two least significant digits of X, when X is expressed in decimal form. Using the seed 11 we obtain
  X   3X   Recurrence graph
 11   33   11 ->
 33   99    33 ->
 99  297     99 ->
 97  291      97 ->
 91  273       91 ->
 73  219        73 ->
 19   57         19 ->
 57  171          57 ->
 71  213           71 ->
 13   39            13 ->
 39  117             39 ->
 17   51              17 ->
 51  153               51 ->
 53  159                53 ->
 59  177                 59 ->
 77  231                  77 ->
 31   93                   31 ->
 93  279                    93 ->
 79  237                     79 ->
 37  111                      37 ->
                               11
We thus obtain a sequence of 20 different numbers distributed as
Range  frequency
 0-19       4
20-39       4
40-59       4
60-79       4
80-99       4
which gives some indication of uniform distribution.

2.5 The mixed congruential method

The mixed congruential random number generator is defined by
        Xi = aXi-1+c (mod m)
The multiplicative congruential generator is a special case of the mixed with c=0.