Randomness in built-in .sort
Bill Baxter
wbaxter at gmail.com
Sun Jan 4 18:25:06 PST 2009
It seems to me that the built-in .sort uses a randomized algorithm
that leads to results that differ from run-to-run when there are
elements with identical keys.
This seems like a bad idea to me for the built-in algorithm to have
non-deterministic behavior because it means you can have bugs that
aren't consistently repeatable.
I think the built-in sort should be some kind of stable sort. Also
the stability or lack thereof is not mentioned in the spec, and it
probably should be because stability is critical for some uses of
sorting. One shouldn't have to guess whether a given implementation
of D will use a stable sort or not.
--bb
More information about the Digitalmars-d
mailing list