PHP returns largest possible random value 32767 on windows?
What is constraint on windows?
echo getrandmax(); //32767
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.
According to the PHP source-code,
getrandmax()is defined as :And
PHP_RAND_MAXis defined as :RAND_MAXitself being defined as :So, if there is an
RAND_MAXdefined, it is used…… And, on Windows with Visual Studio, there is indeed a
RAND_MAXdefined (quoting) :So, basically,
getrandmax()returns32767because that’s how it’s defined on Windows — and PHP often uses what the underlying system exports.