Alea
Non-cryptographic pseudo-random number generator
|
alea.php is a port of the non-cryptographic Alea pseudo-random number generator to PHP.
Alea was designed to be very fast (in JavaScript) and to generate non-platform-dependent repeatable sets of random numbers (when supplied with matching seeds). Given portable seeds (strings or integers, for example), numbers generated by the JavaScript version of alea will exactly match those generated by this PHP port, and vice-versa.
This package is available on Packagist:
We also have the ability to sync up two Alea PRNGs (even across platforms) via the importState
and exportState
methods.
The Alea code was written (in JavaScript) by Johannes Baagøe, and packaged for npm by coverslide.
Read more on Johannes' site.
The port to PHP was initially done by C. Scott Ananian and is (c) Copyright 2019-2021 Wikimedia Foundation.
Both the original alea codebase and this port are distributed under the MIT license; see LICENSE for more info.