Random Number Generators

AdvancedMiner offers several random number generators with uniform distribution. There are two methods available nextRand() and setSeed(int seed).

List of available generators

  1. Knuth's substractive generator

    Knuth's substractive random number generator is described in [1].

    Knuth's substractive random generator is created in the following way:

    KnuthSubstractiveGen().

  2. The long period random number generator of L'Ecuyer with Bays-Durham shuffle

    The long period random number generator of L'Ecuyer with Bays-Durham shuffle is based on two congruential random generators:

    and

    The period of the generator is approximately 2.3*10^18. For the first time it has been described in [2].

    LEcuyerShuffleGen() creates a long period random number generator of L'Ecuyer with Bays-Durham shuffle object.

  3. Marsaglia, Zaman and Tsang generator

    Marsaglia, Zaman and Tsang random number generator is a combination of two simpler Fibonacci generators. The period of the generator is approximately 2.23*10^43. For the first time it has been described in [3].

    MZTGen() creates Marsaglia, Zaman and Tsang random number generator object.

  4. Park-Miller congruential generator

    Park-Miller congruential generator is a simple congruential random generator of Park and Miller:

    The period of the generator is approximately 2.1 * 10^9. For the first time it has been described in [4].

    ParkMillerCongruentialGen() creates a Park-Miller congruential generator object.

  5. Park-Miller congruential generator with shuffle

    It is a simple congruential random generator of Park and Miller with Bays-Durham shuffle.

    The period of the generator is approximately 2.1 * 10^9. It is described in [1].

    ParkMillerShuffleCongruentialGen() creates a Park-Miller congruential generator with shuffle object.

Example 8.7. Random number generator

from biz.sc.math.generators import *

_random = KnuthSubstractiveGen() 
_random.setSeed(123)

for i in range (0,10):
    print "%1.3f" % _random.nextRand()

Output:

0.543
0.553
0.127
0.521
0.093
0.564
0.259
0.037
0.966
0.635