blob: 5c0eccf15f11b9c968cf6c08a18e840cb0cce50c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!./perl
# From: kgb@ast.cam.ac.uk (Karl Glazebrook)
print "1..4\n";
srand;
$m=0;
for(1..1000){
$n = rand(1);
if ($n<0 || $n>=1) {
print "not ok 1\n# The value of randbits is likely too low in config.sh\n";
exit
}
$m += $n;
}
$m=$m/1000;
print "ok 1\n";
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";
}else{
print "ok 2\n";
}
srand;
$m=0;
for(1..1000){
$n = rand(100);
if ($n<0 || $n>=100) {
print "not ok 3\n";
exit
}
$m += $n;
}
$m=$m/1000;
print "ok 3\n";
if ($m<40 || $m>60) {
print "not ok 4\n";
}else{
print "ok 4\n";
}
|