"be consistent" | |
PerlMonks |
Re^2: Answer: How do I get random numbers that follow standard distribution?by hv (Prior) |
on Feb 18, 2005 at 11:56 UTC ( [id://432285]=note: print w/replies, xml ) | Need Help?? |
$w == 0 will occur only when $u1 == $u2 == 1/2, which will happen rarely enough that I can't see it skewing the results noticeably - even if you only have 32-bit random numbers, you'll hit this case only 1.27 in 2^64 times. (That 1.27 is based on my rusty attempts to calculate how many times we loop until we get $w < 1. I think the probability of a success is arcsin(1)/2, which is about 0.78.) Hugo
In Section
Seekers of Perl Wisdom
|
|