Friday, 20 November 2015

18_PHP_RANDOM_NUMBER_GENERATION

Generate Random Number


During the programming if we want to generate random number than …


rand() Function


$rand1= rand();
echo $rand1;


If want to check the maximum range of a random number than we are going to use another php function named “getrandmax()”


Now check out the code below


$rand2=rand(); $max1=getrandmax(); echo $rand2.'/'.$max1;


So above program will gives the value in between the range of 1 to 32767 all the time


if we want to specify the specific range in the rand() function then..



No comments:

Post a Comment