instead of using the Set command for the $rand parts, use:
var %<W/e> $r(#,#)
Works alot better and you dont have to unset the variable every time.