Javatpoint Logo
Javatpoint Logo

PHP lcg_value() Function

PHP lcg_value() function is Combined linear congruential generator. It returns a pseudo random number in a range between 0 and 1. The function combines two CGs with of 2^31 - 85 and 2^31 - 249.

Note: It is not used for cryptographic purpose because it does not generate cryptographic secure value.

Syntax:

Example 1

Output:

Note: Refresh page to get New Value
By using 'lcg_value()' Function your value is: 0.60141092827647

Example 2

Output:

1.0337096475871 2.5723564515363 3.8272724554047 4.8195784319994 5.87424548118 6.047240300926 5.5648232221268

Example 3

Output:

First value :0.68004620904334 
Second value :0.71802104265789 
Third value :0.47515706243563 
Four value :0.27269180070674 
Fift value :0.70378310661499

Note: Refresh page to get new value by using lcg_value() function.

Example 4

Output:

By using 'lcg_value()' function your value is: 0.70264411025106
Converted 'lcg_value()' value into Data typle :double

Next TopicPHP Math





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA