mIRC Home    About    Download    Register    News    Help

Print Thread
$rand range includes negative numbers #264203 09/11/18 05:21 AM
Joined: Jan 2004
Posts: 1,187
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,187
Allow $rand(-10,10) to return a number from the range -10 through +10, and $rand(-20,-10) to return a number from the range -20 through -10.

$rand currently treats a negative number as if text, so $rand(-4,5) is $null and $rand(-4,Z) is $chr($asc(-)) thru $chr($asc(Z)) instead of $null. $rand(-20,-10) always returns hyphen because it's the same as $rand(-,-)

Re: $rand range includes negative numbers [Re: maroon] #264204 09/11/18 01:35 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Nice and useful idea! +1