From: Tom Phoenix Date: Mon, 30 Dec 1996 01:46:21 +0000 (-0800) Subject: More tests X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3524d3b9766c150548bbd837b65d78ef993d647d;p=p5sagit%2Fp5-mst-13.2.git More tests private-msgid: =1) { + if ($n<0) { print "not ok 1\n# The value of randbits is likely too low in config.sh\n"; exit } $m += $n; - + $max = $n if $n > $max; } $m=$m/1000; print "ok 1\n"; +$off = log($max)/log(2); +if ($off > 0) { $off = int(.5+$off) } + else { $off = - int(.5-$off) } +print "# Consider adding $off to randbits\n" if $off > 0; +print "# Consider subtracting ", -$off, " from randbits\n" if $off < 0; + if ($m<0.4) { print "not ok 2\n# The value of randbits is likely too high in config.sh\n"; } elsif ($m>0.6) { - print "not ok 2\n# Something's really weird about rand()'s distribution.\n"; + print "not ok 2\n# The value of randbits is likely too low in config.sh\n"; }else{ print "ok 2\n"; } @@ -49,4 +55,12 @@ if ($m<40 || $m>60) { print "ok 4\n"; } +srand(3.14159); +$r = rand; +srand(3.14159); +print "# srand is not consistent.\nnot " if rand != $r; +print "ok 5\n"; + +print "# rand is unchanging!\nnot " if rand == $r; +print "ok 6\n";