Skip to content

Commit 698fd46

Browse files
committed
Tekst źródłowy ​ 53 / 5 000 Wyniki tłumaczenia Tłumaczenie changes allowing compilation of the rng function in Delphi
1 parent a8c02df commit 698fd46

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

generator/Common/generate.common.pas

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interface
1717

1818
TGenerator = class(TObject)
1919
private
20+
rndState: Array [0..1] of Cardinal;
2021
FInputFile: String;
2122
FOutPutFile: String;
2223
FLineCount: Int64;
@@ -160,17 +161,15 @@ function TGenerator.GenerateProgressBar(APBPosition, APBMax, APBWIdth, AFileSize
160161
end;
161162

162163
function TGenerator.Rng1brc(Range: longint): longint;
163-
const
164-
state: Array [0..1] of DWord = (cSeed, 7266);
165164
var
166-
s0, s1, s2: DWord;
165+
s0, s1, s2: Cardinal;
167166
begin
168-
s0 := state[0];
169-
s1 := state[1] xor s0;
167+
s0 := rndState[0];
168+
s1 := rndState[1] xor s0;
170169
s2 := ((s1 * 3) xor 5) * 7;
171170
Result := longint(Int64(s2 * range) shr 32);
172-
state[0] := s2;
173-
state[1] := s0 xor (s1 shl 9);
171+
rndState[0] := s2;
172+
rndState[1] := s0 xor (s1 shl 9);
174173
end;
175174

176175
procedure TGenerator.Generate;
@@ -186,6 +185,9 @@ procedure TGenerator.Generate;
186185
chunkCount, chunkLen, stationsCount, temperaturesCount: Integer;
187186
start: TDateTime;
188187
begin
188+
//random init
189+
rndState[0] := cSeed;
190+
rndState[1] := 7266;
189191
// Build list of station names
190192
BuildStationNames;
191193

0 commit comments

Comments
 (0)