Yes, the camel book states that some implementations of qsort do crash when fed inconsistent comparision results; that is a valid point.
Also, your version feels more perl-like. But I actually choose the constants 100 and 50 in 'int(rand(100)-50)' to have only 2% chance on an equality result (i.e. 0); my intuition tells me that thus the result will be more random (this will depend on the implementation of qsort; but qsort will typically take the same decission when faced with equality between the elements).
Greetz -- Mave
In reply to Re: Re: random permutations
by mave
in thread random permutations
by mave
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |