Home >>PHP Math Functions >PHP lcg_value() Function
PHP lcg_value() function is used to generate a pseudo-random number between the range of 0 and 1. It does not take any input parameters. It returns a pseudo random value of float type as output that be in the range between 0 and 1.
Syntax:
lcg_value();
Here is an example of lcg_value() Function in PHP:
<html> <body> <?php echo lcg_value(); echo "<br>"; echo lcg_value(); echo "<br>"; echo lcg_value(); echo "<br>"; echo lcg_value(); echo "<br>"; echo lcg_value(); echo "<br>"; echo lcg_value(); echo "<br>"; echo lcg_value(); ?> </body> </html>