Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: is rand random enough to simulate dice rolls?

by LanX (Saint)
on Jan 03, 2021 at 16:33 UTC ( [id://11126214]=note: print w/replies, xml ) Need Help??


in reply to Re: is rand random enough to simulate dice rolls?
in thread is rand random enough to simulate dice rolls?

> At least old perls for Windows had a very limited PRNG, with an interval of only 2^14 (?).

Having an interval of 2**14 ~= 16_000 means the sequence repeats.

> I've no idea how evenly distributed its output is/was.

By definition it must hit the average 3.5 exactly after 2**14 runs.°

IMHO 10000 runs for a margin of ± 0.2 is a safe bet. ²

If this test fails, something must be done.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

°) modulo rounding errors with Perl floats

²) that's more than 3% of the interval!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11126214]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-03-29 11:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found