; Usage: $randrange(<lower>,<upper>,[exclude range][,...])
;
alias randrange {
var %tries = 1, %maxtries = 100, %found = $false, %2 = $2 + 1, %r = $rand($1, %2)
if (%r == %2) %r = $1
while (!%found) {
%found = $true
if !$3 { break }
var %i = 1
while $gettok($3-, %i, 32) != $null {
if %r isnum $ifmatch {
var %found = $false, %i = $numtok($3-, 32), %r = $rand($1, %2)
if (%r == %2) %r = $1
}
inc %i
}
inc %tries
if (%tries == %maxtries) return
}
return %r
}