hedgewars/uRandom.pas
changeset 918 c8cff180da57
parent 916 1d0022336fbb
child 920 4144204da077
equal deleted inserted replaced
917:e59614bffc3f 918:c8cff180da57
    63 
    63 
    64 for i:= 0 to 1023 do GetNext
    64 for i:= 0 to 1023 do GetNext
    65 end;
    65 end;
    66 
    66 
    67 function GetRandom: hwFloat;
    67 function GetRandom: hwFloat;
    68 var r: hwFloat;
       
    69 begin
    68 begin
    70 GetNext;
    69 GetNext;
    71 r.isNegative:= false;
    70 GetRandom.isNegative:= false;
    72 r.QWordValue:= GetNext;
    71 GetRandom.QWordValue:= GetNext
    73 GetRandom:= r
       
    74 end;
    72 end;
    75 
    73 
    76 function GetRandom(m: LongWord): LongWord;
    74 function GetRandom(m: LongWord): LongWord;
    77 begin
    75 begin
    78 GetNext;
    76 GetNext;
    80 end;
    78 end;
    81 
    79 
    82 function rndSign(num: hwFloat): hwFloat;
    80 function rndSign(num: hwFloat): hwFloat;
    83 begin
    81 begin
    84 num.isNegative:= odd(GetNext);
    82 num.isNegative:= odd(GetNext);
    85 if num.isNegative then AddFileLog('isNegative TRUE') else AddFileLog('isNegative FALSE');
    83 AddFileLog(inttostr(n)  +' rnd ' + inttostr(cirbuf[n]));
    86 rndSign:= num
    84 rndSign:= num
    87 end;
    85 end;
    88 
    86 
    89 {$IFDEF DEBUGFILE}
    87 {$IFDEF DEBUGFILE}
    90 procedure DumpBuffer;
    88 procedure DumpBuffer;