[Issue 10269] RandomSample should use popFrontExactly, not popFrontN, when skipping across input range

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 16 11:00:18 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10269



--- Comment #1 from github-bugzilla at puremagic.com 2013-06-16 11:00:16 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/8da0f13596125478b8c3c71ae7fecbe5626fb076
Issue 10269 - RandomSample should use popFrontExactly, not popFrontN, when
skipping across input range

This small tweak has been accompanied by a couple of extra checks
to ensure that users do not request more sample points than are
available in the input, which could otherwise be the source of
exceptions.

There exists one remaining case where RandomSample may fail: if it
is given an InputRange without the .length property, and the user
indicates that the total number of items available is greater
than what the InputRange actually contains.  In this case an
exception is thrown from std.array.popFront() line 450,
"Attempting to popFront() past the end of an array", or from
std.array.front() line 624, "Attempting to fetch the front of an
empty array."

https://github.com/D-Programming-Language/phobos/commit/201e5c2dd17e6c8f151c01276a2545c4d7e0d372
Merge pull request #1342 from WebDrake/randomsample-popfront

Issue 10269 - RandomSample should use popFrontExactly, not popFrontN ...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list