PHP Tutorial - PHP lcg_value() Function






Definition

The lcg_value() function returns a pseudo random number in a range between 0 and 1.

Syntax

PHP lcg_value() Function has the following syntax.

lcg_value();

Parameter

None

Return

Item Description
Return Value A pseudo random float value in a range between 0 and 1
Return Type Float

Example

Return a pseudo random number in a range between 0 and 1:


<?php
echo lcg_value();
?>

The code above generates the following result.