This is regarding the max value of rand();


The max value of rand(); is 32767. But when I type print rand(); i get a very high value , I have attached a screenshot for your reference. Why is teh value greater than 32767.

Replace this line with your code.
print rand();


If called without the optional min, max arguments rand() returns a pseudo-random integer between 0 and getrandmax(). If you want a random number between 5 and 15 (inclusive), for example, use rand(5, 15).

Note: On some platforms (such as Windows), getrandmax() is only 32767. If you require a range larger than 32767, specifying min and max will allow you to create a range larger than this, or consider using mt_rand() instead.

check it here

echo (getrandmax()) // The largest possible value returned by rand()


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.