hedgewars/uRandom.pas
changeset 3284 7ffd0e20ad08
parent 3282 9ca28cef559a
child 3295 ced0ee8280ad
equal deleted inserted replaced
3283:18ee933a5864 3284:7ffd0e20ad08
    75 GetRandom.QWordValue:= GetNext
    75 GetRandom.QWordValue:= GetNext
    76 end;
    76 end;
    77 
    77 
    78 function GetRandom(m: LongWord): LongWord;
    78 function GetRandom(m: LongWord): LongWord;
    79 begin
    79 begin
    80 if m = 0 then
    80 TryDo((m > 0),'GetRandom(0) called! Please report this to the developers!',true);
    81     begin
       
    82     WriteLnToConsole('Warning: GetRandom(0) not defined');
       
    83     GetRandom:= 0;
       
    84     exit
       
    85     end;
       
    86 GetNext;
    81 GetNext;
    87 GetRandom:= GetNext mod m
    82 GetRandom:= GetNext mod m
    88 end;
    83 end;
    89 
    84 
    90 function rndSign(num: hwFloat): hwFloat;
    85 function rndSign(num: hwFloat): hwFloat;