Actually, I call $CardCookie = mt_rand(6103006430040008016, 6103006430040020000); , at the output when generating some cards it gets out of the specified range, it is noticed that there are 24 values somewhere.
How to treat?
Actually, I call $CardCookie = mt_rand(6103006430040008016, 6103006430040020000); , at the output when generating some cards it gets out of the specified range, it is noticed that there are 24 values somewhere.
How to treat?
mt_getrandmax (); - will show whether the threshold of the maximum possible random number of the returned mt_rand is not exceeded. If so, mt_rand may give an error.
mt_rand(min, max); (max - min) <= mt_getrandmax() The number is too large and cannot be represented exactly in the double type.
You may notice that C ++ displays another value: https://ideone.com/2pJ4uh
printf("%.0f", 6103006430040020000.); 6103006430040019968 Related question: Displaying the number 9223372036854775807
Source: https://ru.stackoverflow.com/questions/764889/
All Articles
Диапазон min - max не должен выходить за границы mt_getrandmax(). То есть (max - min) <= mt_getrandmax(). В противном случае, mt_rand() может возвращать менее качественные случайные числа.- Alexey Shimansky1030064300and generate only the remaining part from 40008016 to 40020000. In response, return the string, not the number obtained by concatenating string1030064300and the result of the generation. - Visman