Do you know how to create or generate random number in php
following function we will use to create random number :
rand() :
<?php
echo(rand() . "<br>");
echo(rand() . "<br>");
echo(rand(10,100));
?>
basically syntax of rand function :
<?php
rand();
or
rand(min,max);
?>
min is minimum number of integer value defult is 0
max is maxinum number of digit
mt_rand()
Generate a random value via the Mersenne Twister Random Number Generator
<?phpecho mt_rand() . "\n";
echo mt_rand() . "\n";
echo mt_rand(10, 15);?>
mt_srand() - the Mersenne Twister Random Number Generator
mt_getrandmax() - Show largest possible random value
random_int() - Generates cryptographically secure pseudo-random integers
random_bytes() - Generates cryptographically secure pseudo-random bytes
openssl_random_pseudo_bytes() - Generate a pseudo-random string of bytes
rand() - Generate a random integer
randomly value main purpose to create unique as well as user id generate.
when create user purchase payment transaction number.
if you have any query please comment here or mail me
Thanks,
Disuza Jen,
disuzajen@gmail.com
following function we will use to create random number :
rand() :
<?php
echo(rand() . "<br>");
echo(rand() . "<br>");
echo(rand(10,100));
?>
basically syntax of rand function :
<?php
rand();
or
rand(min,max);
?>
min is minimum number of integer value defult is 0
max is maxinum number of digit
mt_rand()
Generate a random value via the Mersenne Twister Random Number Generator
<?phpecho mt_rand() . "\n";
echo mt_rand() . "\n";
echo mt_rand(10, 15);?>
mt_srand() - the Mersenne Twister Random Number Generator
mt_getrandmax() - Show largest possible random value
random_int() - Generates cryptographically secure pseudo-random integers
random_bytes() - Generates cryptographically secure pseudo-random bytes
openssl_random_pseudo_bytes() - Generate a pseudo-random string of bytes
rand() - Generate a random integer
randomly value main purpose to create unique as well as user id generate.
when create user purchase payment transaction number.
if you have any query please comment here or mail me
Thanks,
Disuza Jen,
disuzajen@gmail.com
Comments