Nice work. smile
You might wanna add another function which will handle the number N, so when you get a string, the number N will be decided by the string itself to prevent lockup, and to prevent N from being greater than 14 (like he whishes).

alias n-return {
var %a = $numtok($1,32)
var %a = $ceil($calc(%a /2))
if (%a > 14) %a = 14
return %a
}

This way N will always be smaller (or equals, in the worst case) than the number of tokens.

Now you use:
$reprand(string,$n-return(string))

You can change the $calc(%a /2) to what ever you want, like $calc(%a *2/3) in order to get a little more random tokens.