superdupercybertechno / randy
The Mersenne Twister in PHP - A seedable pseudorandom number generator
Installs: 5 166
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
README
The Mersenne Twister in PHP - A seedable pseudorandom number generator
Based on this.
Install it using composer:
composer install superdupercybertechno/randy
To use it, add the following to your file:
use superDuperCyberTechno\Randy\Randy;
When you need it, simply invoke it and request numbers.
$randy = new Randy($seed);
$number = $randy->num(0,100);
Where $seed
is a string of your choosing. If you leave out $seed
, Randy will seed itself with a random number.
Each time you run the method num
you will receive a new number within the limits passed (0
and 100
in the above example). Using the same seed will produce a predictable batch of numbers.