From: Jarrett Malone <[EMAIL PROTECTED]> > Let me apologize is advance if this is > wrong list or has already been addressed etc. > rand seems to produce an abnormally high > number of zeros, like 20 or 30 per million > > active perl binary v5.8.0 Build 804 > > > $t = 0; > for($k=0;$k<1000000;$k++) { > $t = rand(1); > if ($t == 0.0) { print "tt $t\n"; } > }
I seem to get more 0.5s than 0.0s: $t = 0; $zeroes = 0; $halves = 0; for($k=0;$k<1000000;$k++) { $t = rand(1); $zeroes++ if ($t == 0.0); $halves++ if ($t == 0.5); } print "0.0: $zeroes\n0.5: $halves\n"; And results: 0.0: 27 0.5: 41 0.0: 26 0.5: 33 0.0: 29 0.5: 28 0.0: 32 0.5: 38 0.0: 26 0.5: 31 Jenda ===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs