|Just another Perl shrine|
A pseudorandom process is a process that appears to be random but is not. Pseudorandom sequences typically exhibit statistical randomness while being generated by an entirely deterministic causal process.
So yes, the “statistical randomness” guarantees that there is an equal probability of choosing either value.
I notice that it is very rare for me to get 5 heads and 5 tails.
Well, the probability of getting 5 heads in a row followed by 5 tails in a row is 1/1024. But the probability that 10 rolls will result in 5 heads and 5 tails (in any order) is (10!/5!5!)/1024 = 0.246 or approx. 25%, so this should happen around once in every 4 runs of the simulation.
Is there a better way to do this?
Don’t call a sub using the & prefix:
This syntax is used for overriding prototypes, and should be avoided unless you have a good reason to use it. Prefer:
Hope that helps,
Athanasius <°(((>< contra mundum