http://d.puremagic.com/issues/show_bug.cgi?id=10322
--- Comment #6 from [email protected] 2013-09-26 12:36:08 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/ce8155c7adf906582926b068cac33856f9cb26fa Fix Issue 10322 - ensure RandomSample is initialized before use This patch fixes a problem where the public methods .index() or .popFront() might be called without the first value of the sample having been determined, which would then cause spurious results. The runtime initialization check currently performed in .front has been extended to those methods. The private boolean checks in the previous implementation have been replaced with an enum indicating the algorithm to be used (A, D or None) with None indicating that the sample has not been initialized. Step D1 of Algorithm D has been moved to the skip() function, which results in a significant performance boost. Unittests have been introduced to cover the cases where .index or .popFront() are called before .front. Finally, the .index method has been made a @property, which I take to be an oversight of the original code. https://github.com/D-Programming-Language/phobos/commit/cedee1617a82c60da38511c297d05e7a146ce341 Merge pull request #1533 from WebDrake/randomsample-init Fix Issue 10322 - ensure RandomSample is initialized before use -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
