You are joking right? That isn't easy nor is it correct.

Blue is correct.
Red is incorrect.

Code:
;$1 = nummer of nicks to kick
[color:blue]alias randomkick {[/color]
  [color:red]var i = 0[/color]
  [color:red]while(i<=$1){[/color]
    [color:red]kick $chan $nick($chan,random(1,$nick($chan,0),a,o)[/color]
    [color:red]i++[/color]
  [color:red]}[/color]
[color:blue]}[/color]


Corrections to your code line by line.

[*]var %i = 1
[*]while (%i <= $1) {
[*]The KICK command definitely wouldn't have worked because there is no $random() identifier and you didn't include %i in the $nick() call.
[*]The main reason it wouldn't have worked is because you didn't incease the var. (i++[/color should be inc %i)

Points you may want to take note to:

[*]Spacing is vital in code so make sure you view the help file thouroughly.
[*]You may want to stick to the language you've been writing in..
[*]You may want to test the code before you post it.

You could also try something a little like:

Code:
alias randk {
  var %i = 1
  while (%i &lt;= $2) {
    if (($nick($1,%i) !isop $1) &amp;&amp; ($nick($1,%i) != $me)) {
      kick $1 $nick($1,%i) $3-
    }
    inc %i
  }
}


/randk <#channel> <Number of people> <Reason if you want>

-Andy