One in a Billion pseudo random probability test

Perl Add comments

#!/usr/bin/perl
srand;
$c=0;
for ($i=0; $i<1e6; $i++) {$c++ if rand(1e9) < 1} print "One in a Billion occured $c times!\n";
print "\nMachines with randbits=15 it's about 30.\nChecking perl -V:randbits\n";
exec("perl -V:randbits\n");

Leave a Reply

You must be logged in to post a comment.

WebSite Powered by webHauser
Entries RSS Comments RSS Login