Hi,
There's a bug in mIRC 6.03 regarding the $rand function that is not present in 6.0 and 6.01. When I do $rand(1, 20) for example, the number of 1's and 20's that show up is only half to 2-19.
I told some other people about it and they can't reproduce the error under the two earlier mentioned versions, but they get the same result as me under 6.03
Example output of the script I ran, changed to $rand(1,3) for brevity:
10000 iterations performed
-----------------------
1: 2521 occurences (25.21 percent)
2: 4999 occurences (49.99 percent)
3: 2480 occurences (24.8 percent)
Here's the script itself:
/probtest {
var %max = 3
var %i = 1
while (%i < $1) {
var %prob_ [ $+ [ %i ] ]
inc %i
}
%i = 0
while (%i < $1) {
inc %prob_ [ $+ [ $rand(1, %max) ] ]
inc %i
}
echo 2 $1 iterations performed
echo 2 -----------------------
%i = 1
var %nr
while (%i <= %max) {
%nr = [ %prob_ [ $+ [ %i ] ] ]
echo 2 %i $+ : %nr occurences ( $+ $calc(%nr / $1 * 100) percent)
inc %i
}
}
I solved it temporarely by using the following alias instead:
/dice_rand {
if ($0 < 2) return
var %result
while (!%result || %result < $1 || %result > $2) {
%result = $rand($calc($1 - 1) , $calc($2 + 1))
}
return %result
}
However I suggest you change the $rand command to what it was