On Wed, Apr 03, 2002 at 10:37:08PM -0700, Sean M. Burke wrote:
> sub fy2 {
> my($deck,$i,$j,$t) = $_[0];
> $i = @$deck || return;
> while(1) {
> $j = int rand($i-- || return);
This causes a useless iteration when $i == 1. I'm guessing you know
this, but it still helped your benchmarks.
To make this potentially fun: What other algorithms succeed despite
off-by-one "errors"? Ideally, they should succeed for interesting
reasons!
(I remember seeing a heap sort example on this very list:
http:[EMAIL PROTECTED]/msg00082.html)
Andrew