PHP lcg_value() Function

Definition and Usage

lcg_value() combines linear congruential generators.

Syntax

lcg_value()

Description

lcg_value() returns a pseudo-random number in the range (0, 1). This function combines two congruential generators with periods of 2^31 - 85 and 2^31 - 249. The period of this function is equal to the product of these two prime numbers.

Example

<?php
echo lcg_value();
?>

Output similar to:

0.508212039328