Linear congruential generator
Compatible with LOCALE only, up to PHP 7.4.XX.
<?php
float lcg_value ()
?>
<?php
// Run this code several times
$lcgval01 = lcg_value();
echo 'The generated random number
for this system in this moment, is: '
. $lcgval01 . '.<br><br>';
// setlocale(LC_ALL, 'pt-PT', 'pt_PT');
echo 'The generated random number
for this system in this moment, is: '
. $lcgval01 . '.<br><br>';
?>
<?php
echo "MATHS test script started.";
echo "<br><br>lcg_value tests...<br>";
for ($i = 0; $i < 100; $i++) {
$res = lcg_value();
if (!is_float($res) || $res < 0 || $res > 1) {
break;
}
}
if ($i != 100) {
echo "FAILED<br>";
} else {
echo "PASSED<br>";
}
echo "MATHS test script completed<br>";
?>