* compilation of tests on 32 bit targets fixed, using while loops so keeping the type sizes

git-svn-id: trunk@42526 -
This commit is contained in:
florian 2019-07-28 21:06:37 +00:00
parent b3ed34592f
commit 3ef319c0b0
2 changed files with 17 additions and 10 deletions

View File

@ -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);

View File

@ -1,9 +1,9 @@
var
rand, val: int64;
i: int32;
i, rand, val: int64;
begin
rand:=-5;
for i:=1 to 10000 do
i:=1;
while i<=10000 do
begin
val:=random(rand);
if (val<-5) or (val>0) then
@ -11,5 +11,6 @@ begin
writeln('error: ', val);
halt(1);
end;
Inc(i);
end;
end.