2
* This file is part of the dis-Emi-A HaXe Library. Copyright © edA-qa mort-ora-y
3
* For full copyright and license information please refer to doc/license.txt.
9
* The classic random number generator.
10
* http://en.wikipedia.org/wiki/Linear_congruential_generator
12
class LinearCongruentialGenerator implements RandomGenerator
18
public function new( a : Int, c : Int, ?seed : Null<Int> = null )
24
cur = Math.round( haxe.Timer.stamp() * 1000 );
29
static public function standard()
32
//from Numeric recipes
33
return new LinearCongruentialGenerator( 1664525, 1013904223 );
36
return new LinearCongruentialGenerator( 1103515245, 12345 );
40
public function nextFloat() : Float
42
return nextInt() / Limits.intMax;
45
public function nextInt() : Int
48
return MathUtil.absi( cur );
51
public function reseed( seed : Int ) : Void