Random Extension Polyfill for PHP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Anton Smirnov d923e77b92 Plain string 7 days ago
debug Plain string 7 days ago
docs Update compatibility 1 week ago
src These constant-like variables must always be set 1 week ago
tests Test serialization 1 week ago
.gitattributes do not export doc configs 3 weeks ago
.gitignore I always forget which one I use 2 weeks ago
.gitlab-ci.yml allow_failure on 8.2 2 weeks ago
CHANGELOG.md Changelog for 0.3.0 1 week ago
COPYING.adoc Legalese 3 weeks ago
LICENSE.md Legalese 3 weeks ago
README.md Update docs 1 week ago
composer.json Actually we provide 8.2.0 1 week ago
phpcs.xml Suppress crashing sniff 3 weeks ago
phpunit.xml.dist Test Secure 3 weeks ago
psalm.xml Psalm config and fixes 3 weeks ago


Random Extension Polyfill for PHP

Packagist PHP Packagist Gitlab pipeline status Codecov

This is a polyfill for the new ext-random extension that will be released with PHP 8.2.



  • PHP 7.1
  • GMP extension


composer require 'arokettu/random-polyfill'


The library is compatible with ext-random as released in PHP 8.2.0 beta 1.

What works

  • Random\Randomizer
  • Engines
    • Random\Engine interface
    • Random\CryptoSafeEngine interface
    • Secure Engine: Random\Engine\Secure
    • Mersenne Twister: Random\Engine\Mt19937
    • PCG64: Random\Engine\PcgOneseq128XslRr64
    • xoshiro256**: Random\Engine\Xoshiro256StarStar


  • Keep updating with fixes from the upcoming betas and release 1.0.0 around PHP 8.2.0 rc 1
  • Empty arokettu/random-polyfill v1.99 for PHP 8.2.0 users
  • Spin-off without extension dependencies?


Read full documentation here: https://sandfox.dev/php/random-polyfill.html

Also on Read the Docs: https://php-random-polyfill.readthedocs.io/


Please file issues on our main repo at GitLab: https://gitlab.com/sandfox/php-random-polyfill/-/issues


The library is available as open source under the terms of the 3-Clause BSD License. See COPYING.adoc for additional licenses.