in reply to Perl rand() generates larger numbers for small sample size, bug!
Why are random numbers important to you - what are you using them for? If truly random numbers are important to you, use a better source.
rand says this:
"rand()" is not cryptographically secure. You should not rely on it in security-sensitive situations. As of this writing, a number of third-party CPAN modules offer random number generators intended by their authors to be cryptographically secure, including: Data::Entropy, Crypt::Random, Math::Random::Secure, and Math::TrulyRandom.
This average should be close to 0.5.
Really? Here's a good point to start your research: http://www.random.org/analysis/
It seems that with smaller sample size, rand() functions is biased to produce larger numbers but not the smaller number.
If it were true that it's a fault of rand and not something else, how would rand know the sample size and adjust its output accordingly...?
Since I am not expert in statistics
And yet you claim a "bug", and "Perl's rand() function failed"?
rand also says this:
(Note: If your rand function consistently returns numbers that are too large or too small, then your version of Perl was probably compiled with the wrong number of RANDBITS.)
So if you really, really suspect a bug, perhaps investigate that?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl rand() generates larger numbers for small sample size, bug!
by Bethany (Scribe) on Aug 08, 2014 at 02:23 UTC |