From 9a7803d3f72db5ce8db01c0a314f68ab1a2921b3 Mon Sep 17 00:00:00 2001 From: Raymond Date: Sat, 26 Dec 2009 16:49:02 +0000 Subject: [PATCH] randomrange shit git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@348 3f818213-9676-44b0-a9b4-5e4c4e03d09d --- Units/MMLAddon/PSInc/Wrappers/math.inc | 5 +++++ Units/MMLAddon/PSInc/psexportedmethods.inc | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Units/MMLAddon/PSInc/Wrappers/math.inc b/Units/MMLAddon/PSInc/Wrappers/math.inc index c7dfb7b..1dacd78 100644 --- a/Units/MMLAddon/PSInc/Wrappers/math.inc +++ b/Units/MMLAddon/PSInc/Wrappers/math.inc @@ -25,3 +25,8 @@ function psSqr( e : extended) : extended; begin; result := sqr(e); end; + +function ps_RandomRange(const aFrom, aTo: Integer): Integer; +begin + Result:=Random(Abs(aFrom-aTo))+Min(aTo,AFrom); +end; diff --git a/Units/MMLAddon/PSInc/psexportedmethods.inc b/Units/MMLAddon/PSInc/psexportedmethods.inc index 4262a9e..2c1500b 100644 --- a/Units/MMLAddon/PSInc/psexportedmethods.inc +++ b/Units/MMLAddon/PSInc/psexportedmethods.inc @@ -51,7 +51,7 @@ AddFunction(@pssqr,'function Sqr(e : extended) : extended;'); AddFunction(@classes.point,'function Point(x,y:integer) : TPoint;'); AddFunction(@Distance,'function Distance(x1,y1,x2,y2 : integer) : integer;'); AddFunction(@hypot,'function Hypot(X, Y: Extended): Extended;'); -AddFunction(@RandomRange,'function RandomRange(aFrom,aTo: Integer): Integer;'); +AddFunction(@ps_RandomRange,'function RandomRange(aFrom,aTo: Integer): Integer;'); {window} SetCurrSection('Window');