You could do something like this, as an example, for randomization:
on @*:text:!xbox:#: {
var %x $r(1,8), %y goto, %z msg #
$iif(%x = 1,%y 1,$iif(%x = 2,%y 2,$iif(%x = 3,%y 3,$iif(%x = 4,%y 4,$&
$iif(%x = 5,%y 5,$iif(%x = 6,%y 6,$iif(%x = 7,%y 7,$iif(%x = 8,%y 8))))))))
:1 | %z you won an op! | mode # +o $nick | halt
:2 | %z you won halfop! | mode # +h $nick | halt
:3 | %z you won voice! | mode # +v $nick | halt
:4 | %z you won a kick! | kick # $nick Better luck next time. | halt
:5 | %z you won admin! | mode # +a $nick | halt
:6 | %z you won owner! | mode # +q $nick | halt
:7 | %z you won op! | mode # +o $nick | halt
:8
%z you won the rabid dog!
timer 1 1 describe # gives $nick a rabid dog that mauls them to death.
timer 1 2 kick # $nick You died.
halt
}
I know, it's goto...lol
As a side note, for the rand variable, you can set it local. You don't have to set it as global, which adds an unneeded space in your variables anyway.