The Mersenne Twister in PHP - A seedable pseudorandom number generator

1.0.0 2019-11-14 10:55 UTC

This package is auto-updated.

Last update: 2025-06-14 23:47:15 UTC


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.