phpOMS/Utils/Random/LinearCongruentialGenerator.php
Dennis Eichhorn 78bc28b045 Draft
All these files need further edits + other optimization files + moving
of files
2016-03-13 21:49:01 +01:00

17 lines
398 B
PHP

<?php
class LinearCongruentialGenerator
{
public static function bsd(int $seed)
{
return function() use(&$seed) {
return $seed = (1103515245 * $seed + 12345) % (1 << 31);
}
}
public static function msvcrt(int $seed) {
return function() use (&$seed) {
return ($seed = (214013 * $seed + 2531011) % (1 << 31)) >> 16;
};
}
}