3v4l.org

run code in 300+ PHP versions simultaneously
<?php function my_mt_srand(?int $seed = null) { $GLOBALS['my_mt_rand'] = new \Random\Randomizer(new \Random\Engine\Mt19937($seed)); } function my_mt_rand($min = null, $max = null) { if (!isset($GLOBALS['my_mt_rand'])) { $GLOBALS['my_mt_rand'] = new \Random\Randomizer(new \Random\Engine\Mt19937()); } if ($min === null && $max === null) { return $GLOBALS['my_mt_rand']->nextInt(); } return $GLOBALS['my_mt_rand']->getInt($min, $max); } mt_srand(1234); my_mt_srand(1234); var_dump(mt_rand()); var_dump(my_mt_rand()); var_dump(mt_rand(1, 1000)); var_dump(my_mt_rand(1, 1000));
Output for git.master, git.master_jit
int(411284887) int(411284887) int(172) int(172)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
36.78 ms | 401 KiB | 7 Q