PHP lcg_value() Function

In this chapter you will learn:

  1. Definition for PHP lcg_value() Function
  2. Syntax for PHP lcg_value() Function
  3. Parameter for PHP lcg_value() Function
  4. Return for PHP lcg_value() Function
  5. 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:

  1. Definition for PHP log() Function
  2. Syntax for PHP log() Function
  3. Parameter for PHP log() Function
  4. Return for PHP log() Function
  5. Example - Return the natural logarithm of different numbers