in reply to Re: random permutations
in thread random permutations
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: random permutations
by gryng (Hermit) on Mar 12, 2001 at 20:29 UTC | |
by tye (Sage) on Mar 12, 2001 at 21:18 UTC | |
by gryng (Hermit) on Mar 12, 2001 at 21:30 UTC | |
|
Re: Re: Re: random permutations
by MrNobo1024 (Hermit) on Mar 12, 2001 at 01:40 UTC |