I am using the following code
$wID=rand(2, 4);
to generate numbers from 2 to 4, how can i generate numbers starting from 2 but no maximum?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use mt_rand (it’s better).
No computer can produce an infinite set of numbers.
If you call
mt_randwithout arguments, it will return a number between0and the value of mt_getrandmax(). So, if you want, you can do:or:
or just enter a very high max of your choosing.