hedgewars/uRandom.pas
changeset 155 401f4ea24715
parent 136 89970b70b076
child 183 57c2ef19f719
equal deleted inserted replaced
154:5667e6f38704 155:401f4ea24715
    55 end;
    55 end;
    56 
    56 
    57 procedure SetRandomSeed(Seed: shortstring);
    57 procedure SetRandomSeed(Seed: shortstring);
    58 var i: Longword;
    58 var i: Longword;
    59 begin
    59 begin
       
    60 n:= 54;
       
    61 
    60 if Length(Seed) > 54 then Seed:= copy(Seed, 1, 54); // not 55 to ensure we have odd numbers in cirbuf
    62 if Length(Seed) > 54 then Seed:= copy(Seed, 1, 54); // not 55 to ensure we have odd numbers in cirbuf
    61 
    63 
    62 for i:= 0 to pred(Length(Seed)) do
    64 for i:= 0 to pred(Length(Seed)) do
    63     cirbuf[i]:= byte(Seed[i + 1]) * (i + 1);
    65     cirbuf[i]:= byte(Seed[i + 1]) * (i + 1);
    64 
    66