The Mersenne Twister in PHP - A seedable pseudorandom number generator

Maintainers

Package info

github.com/superDuperCyberTechno/randy

pkg:composer/superdupercybertechno/randy

Statistics

Installs: 7 807

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2019-11-14 10:55 UTC

This package is auto-updated.

Last update: 2026-03-15 01:17:16 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.