|
@@ -4,8 +4,8 @@ program random_test;
|
|
|
const
|
|
|
l: UInt64 = 6148914691236517205;
|
|
|
var
|
|
|
- s,n: UInt32;
|
|
|
- i,j: UInt32;
|
|
|
+ s,n: UInt64;
|
|
|
+ i,j: UInt64;
|
|
|
begin
|
|
|
WriteLn('Experiment:', LineEnding);
|
|
|
WriteLn(' Draw a natural number r from the intervall [0,l-1] and');
|
|
@@ -16,14 +16,20 @@ begin
|
|
|
|
|
|
WriteLn('Input size n':16, 'Observed ratio s/n':30);
|
|
|
l := 6148914691236517205;
|
|
|
- for j := 4 to 18 do
|
|
|
+ j := 4;
|
|
|
+ while j <= 18 do
|
|
|
begin
|
|
|
- n := (Int32(1) shl j);
|
|
|
+ n := (UInt64(1) shl j);
|
|
|
s := 0;
|
|
|
- for i := 0 to n-1 do
|
|
|
- if Random(Int64(l)) < l div 2 then
|
|
|
- Inc(s);
|
|
|
+ i := 0;
|
|
|
+ while i <= n-1 do
|
|
|
+ begin
|
|
|
+ if Random(Int64(l)) < l div 2 then
|
|
|
+ Inc(s);
|
|
|
+ Inc(i);
|
|
|
+ end;
|
|
|
WriteLn( (UInt64(1) shl j):16, s/n:30);
|
|
|
+ Inc(j);
|
|
|
end;
|
|
|
if abs(0.5-(s/n))>0.1 then
|
|
|
halt(1);
|