Skip to content

IPRIT/lehmer-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lehmer Linear Congruent Pseudorandom Number Generator CRAY

The current generator named as CRAY allows to generate numbers included in the interval from 0 to 1 with period 2^46 and binary modulo exponentiation and multiplication. The selected values for the Lehmer generator:

a = 44 485 709 909 377, c = 0, m = 2^48, X0 = 1.

You can create random variables with a single basic interval.

CBasicRandomValue basicGenerator = new CBasicRandomValue();
for (int i = 0; i < 100000; ++i)
    basicGenerator.next();

You can also create random variables using a factory, which divides produced sequence of numbers into several parts and gives a better result.

int seed = 1234;
CLinearCongruentGenerator linearGenerator = new CLinearCongruentGenerator(seed);

CBasicRandomValue basicGeneratorFirst = new CBasicRandomValue(linearGenerator);
for (int i = 0; i < 1 << 20; ++i)
    basicGeneratorFirst.next();
    
CBasicRandomValue basicGeneratorSecond = new CBasicRandomValue(linearGenerator);
for (int i = 0; i < 1 << 20; ++i)
    basicGeneratorSecond.next();

About

Lehmer Pseudorandom Number Generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages