You can select a random user from the viewewlist with just one line of code with no need to loop or write to a text file.
Code:
ON *:TEXT:!random:#: MSG $chan $nick($chan,$rand(1,$nick($chan,0)))

Alternatively, if you want to only select an ACTIVE user (one that has said something recently), see my randuser.mrc script on my GitHub linked in my signature.

Last edited by Blas; 20/09/16 03:59 AM.