There isn't a "for" command in mIRC. Also, use [[b][/b]code] tags around code, please. It makes it easier to read.

Code:
alias rk {
  if ($chan == $null || $me !isop $chan) { echo -a Error: You must be on the channel and opped to use this command. | return }
  var %i = 1
  var %x = $1
  if (%x == $null) { var %x = 5 }
  while (%i <= %x) {
    var %nick = $nick($chan,$rand(1,$nick($chan,0)))
    while (%nick != $me) {
      var %nick = $nick($chan,$rand(1,$nick($chan,0)))
    }
    kick $chan %nick What bad luck... You have been randomly kicked.
    inc %i
  }
}


If you just type /rk in a channel, it will randomly kick 5 people. If you include a number after it, it will randomly kick that number of people. It will only work if you use it IN a channel and if you're opped (or it will give an error). It will also not kick you.

If you have questions, just ask.