by xentronium · 15y ago · 0 comments
Pick median of three random elements as pivot; it's hard to pick wrong pivot every time unless your RNG always returns 7.
On the other hand, if you are sorting unsanitised input, then random is good, but it should be secure pseudo-random numbers if it's important to your security/performance whilst under attack.