hedgewars/uRandom.pas
changeset 2699 249adefa9c1c
parent 2630 079ef82eac75
child 2716 b9ca1bfca24f
equal deleted inserted replaced
2698:90585aba87ad 2699:249adefa9c1c
    21 unit uRandom;
    21 unit uRandom;
    22 interface
    22 interface
    23 uses uFloat;
    23 uses uFloat;
    24 {$INCLUDE "proto.inc"}
    24 {$INCLUDE "proto.inc"}
    25 
    25 
       
    26 procedure init_uRandom;
    26 procedure SetRandomSeed(Seed: shortstring);
    27 procedure SetRandomSeed(Seed: shortstring);
    27 function  GetRandom: hwFloat; overload;
    28 function  GetRandom: hwFloat; overload;
    28 function  GetRandom(m: LongWord): LongWord; overload;
    29 function  GetRandom(m: LongWord): LongWord; overload;
    29 function  rndSign(num: hwFloat): hwFloat;
    30 function  rndSign(num: hwFloat): hwFloat;
    30 {$IFDEF DEBUGFILE}
    31 {$IFDEF DEBUGFILE}
    34 implementation
    35 implementation
    35 {$IFDEF DEBUGFILE}
    36 {$IFDEF DEBUGFILE}
    36 uses uMisc;
    37 uses uMisc;
    37 {$ENDIF}
    38 {$ENDIF}
    38 var cirbuf: array[0..63] of Longword;
    39 var cirbuf: array[0..63] of Longword;
    39     n: byte = 54;
    40     n: byte;
    40 
    41 
    41 function GetNext: Longword;
    42 function GetNext: Longword;
    42 begin
    43 begin
    43 n:= (n + 1) and $3F;
    44 n:= (n + 1) and $3F;
    44 cirbuf[n]:=
    45 cirbuf[n]:=
    91 for i:= 0 to 63 do
    92 for i:= 0 to 63 do
    92 	AddFileLog('[' + inttostr(i) + '] = ' + inttostr(cirbuf[i]))
    93 	AddFileLog('[' + inttostr(i) + '] = ' + inttostr(cirbuf[i]))
    93 end;
    94 end;
    94 {$ENDIF}
    95 {$ENDIF}
    95 
    96 
       
    97 procedure init_uRandom;
       
    98 begin
       
    99 	n:= 54;
       
   100 end;
       
   101 
    96 end.
   102 end.