>>does the trick... at nearly 1/3rd the speed.
>Compared to what? I kinda lost you there.

My $r2 function compared to mIRC's $rand function. my $r2 is 3x slower than $rand.
I meant to phrase that "but at 1/3rd the speed."

>Hammer's algorithm is faster (constant-time), as it takes advantage of the fact that edge numbers appear exactly half as often. Here's the r2 alias that implements this algorithm:

I didn't completly deceminate the method he was using, because I was too busy disproving any bug with $rand(a,z). I do see now that his example, though it didn't support numbers, used the same logic as starbuck's-- so I shout praise in hammer's direction too.

> alias r2 if $rand($1,$calc($2 + 1)) <= $2 { return $ifmatch } | return $1
> Your method could fix any edge-numbers problem, this one can only fix the current $rand().

Agreed. But that's all we want to do, is fix the edge problem... isn't it?
And that looks exactly like starbuck's code, sans bounds checking for letters.

All I was doing is saluting starbuck's example.
I'm sorry I missed the method behind hammer's code.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!