[Issue 10322] std.random.RandomSample.index() returns wrong value if called before front()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 10 09:01:06 PDT 2013


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



--- Comment #2 from Joseph Rushton Wakeling <joseph.wakeling at webdrake.net> 2013-06-10 09:01:04 PDT ---
The problem also extends to popFront(), which also requires front() to be
initialized before it can be called.  If not, the output may correspond to
sampling (n-1) items from (N-1), whereas it should involve sampling (n-1) items
from whatever remains of the input range after the first sample point is taken.

I'm not sure how to reliably unittest this, but example code will be attached
shortly.

-- 
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