Answer the question
In order to leave comments, you need to log in
Why can rand() produce very close values?
Why rand() sometimes works fine, but sometimes it can produce something like this in a row:
1173
1174
1250
1259
These values were output by the function in 4 days at 0:00
upd.
As of PHP 7.1.0, rand() uses the same random number generation algorithm as mt_rand().
code that is run by cron once a day:
<?php
echo rand(1000,1300);
?>
Answer the question
In order to leave comments, you need to log in
https://toster.ru/answer?answer_id=1169362#answers...
Why rand() is bad
boallen.com/random-numbers.html
Real random (or good pseudo random like mt_rand())
Pseudo random
Because random.
Someone here needs to understand for themselves the meaning of this word. And obviously not just one author.
By chance, there may be not only "close" but generally the same values.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question