PHP lcg_value() Function
In this chapter you will learn:
- Definition for PHP lcg_value() Function
- Syntax for PHP lcg_value() Function
- Parameter for PHP lcg_value() Function
- Return for PHP lcg_value() Function
- Example - Return a pseudo random number in a range between 0 and 1
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.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP log() Function
- Syntax for PHP log() Function
- Parameter for PHP log() Function
- Return for PHP log() Function
- Example - Return the natural logarithm of different numbers
Home » PHP Tutorial » PHP Math Functions