hedgewars/uRandom.pas
changeset 915 33040b7695c0
parent 527 e23490ce1f06
child 916 1d0022336fbb
--- a/hedgewars/uRandom.pas	Thu May 08 14:54:48 2008 +0000
+++ b/hedgewars/uRandom.pas	Thu May 08 18:02:52 2008 +0000
@@ -25,8 +25,15 @@
 procedure SetRandomSeed(Seed: shortstring);
 function  GetRandom: hwFloat; overload;
 function  GetRandom(m: LongWord): LongWord; overload;
+function  rndSign(num: hwFloat): hwFloat;
+{$IFDEF DEBUGFILE}
+procedure DumpBuffer;
+{$ENDIF}
 
 implementation
+{$IFDEF DEBUGFILE}
+uses uMisc;
+{$ENDIF}
 var cirbuf: array[0..63] of Longword;
     n: byte = 54;
 
@@ -72,4 +79,19 @@
 GetRandom:= GetNext mod m
 end;
 
+function rndSign(num: hwFloat): hwFloat;
+begin
+num.isNegative:= odd(GetNext);
+rndSign:= num
+end;
+
+{$IFDEF DEBUGFILE}
+procedure DumpBuffer;
+var i: LongInt;
+begin
+for i:= 0 to 63 do
+	AddFileLog('[' + inttostr(i) + '] = ' + inttostr(cirbuf[i]))
+end;
+{$ENDIF}
+
 end.