Javatpoint Logo
Javatpoint Logo

PHP gmp_random_bits() function

The PHP gmp_random_bits() function creates a random value or number of the given input GMP number.

This function uses equation to find random number which is the "(2 * $input_num) - 1". The $input_num data must be greater than 0. The maximum number of input data depends on the memory size.

Syntax

The given syntax shows the GMP function for creating random values of the bit.

Parameters

  • As shown in the gmp_randon_bits() function syntax, this function takes a GMP numerical value as an essential parameter. The input parameter is written as a $input_num.
  • In PHP version 5.6 and afterword versions use the gmp_randon_bits() function to required output. We can use the numeric data as an input, or the numerical string that turns into a number.

Return Value

The function shows output in numerical format to generate a random value or bits of the given input value.

Examples

Example1: the given example generates "random bits" of the given single positive input value.

Output:

The following output identifies the random bits of the given value.

PHP gmp_random_bits() function

Example2: The given example shows random bits of the given variable.

Output:

The following output identifies the random bits of the given value.

PHP gmp_random_bits() function

Example3: The given example creates random bits of the given variable.

Output:

The following output identifies the random bits of the given value.

PHP gmp_random_bits() function

Conclusion

The gmp_random_bits() function shows the random bits of the input number. This function works on the complicated mathematical operation.







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