note
LanX
The rand function is supposed to be a "Pseudorandom number generator".<P>
And the requirements for [https://en.wikipedia.org/wiki/Pseudorandom_number_generator#Mathematical_definition|PRNG's are mathematically defined].<P>
One of them says, that for every range epsilon <tt>ε</tt> around the expected average <C>P(E)</C> you can find a minimum set size <C>N</C> such that the actual average will always be within that range. <P>
That's math-speak for "the bigger the closer".<P>
And that's very similar to your test, with the exception that there is no guaranty about this set size 10000. Could be less, could be more.<P>
From my tests it's very likely to hold for 10000 tho, but you can only be "sure"° after checking the implementation.<P>
HTH! :)<P>
<div class="pmsig"><div class="pmsig-708738">
<!--nowiki--><p>Cheers Rolf<br>
<sub>(addicted to the Perl Programming Language :)
<br> <i> [id://1153804|Wikisyntax for the Monastery]</i>
</sub>
<!--nowiki-->
</div></div><P>
°) DISCLAIMER: security is relative if it comes to software and it's implementation<!-- Wiki2Monks {"version":1.16} -->
11126201
11126201