September 26, 2013
  Branch: refs/heads/master
  Home:   https://github.com/D-Programming-Language/phobos
  Commit: ce8155c7adf906582926b068cac33856f9cb26fa
      https://github.com/D-Programming-Language/phobos/commit/ce8155c7adf906582926b068cac33856f9cb26fa
  Author: Joseph Rushton Wakeling <joe@webdrake.net>
  Date:   2013-09-26 (Thu, 26 Sep 2013)

  Changed paths:
    M std/random.d

  Log Message:
  -----------
  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.


  Commit: cedee1617a82c60da38511c297d05e7a146ce341
      https://github.com/D-Programming-Language/phobos/commit/cedee1617a82c60da38511c297d05e7a146ce341
  Author: monarch dodra <monarchdodra@gmail.com>
  Date:   2013-09-26 (Thu, 26 Sep 2013)

  Changed paths:
    M std/random.d

  Log Message:
  -----------
  Merge pull request #1533 from WebDrake/randomsample-init

Fix Issue 10322 - ensure RandomSample is initialized before use


Compare: https://github.com/D-Programming-Language/phobos/compare/d9073b3a23b2...cedee1617a82