Bug 2898 – Allow RandomCover to sample both w/ and w/o replacement.
Status
RESOLVED
Resolution
WONTFIX
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-04-25T10:47:00Z
Last change time
2017-08-08T20:03:36Z
Keywords
bootcamp, trivial
Assigned to
dsimcha
Creator
dsimcha
Comments
Comment #0 by dsimcha — 2009-04-25T10:47:27Z
Currently, RandomCover only allows sampling without replacement. I have created a modified version, located at http://dsource.org/projects/scrapple/browser/trunk/rangeextra/randomcover.d , that also allows sampling a random access range with replacement as an infinite range. This is done by template overloading on w/ or w/o replacement.
This version of RandomCover also fixes bug 2865 and, in the w/o replacement version, replaces the bool[] with a BitArray for better space efficiency.
Comment #1 by andrei — 2011-06-05T08:07:08Z
David, I'm reassigning this to you. I've never had a need for random cover with replacement, but if you can collect enough evidence please make a pull request. Thanks!
Comment #2 by andrei — 2015-11-03T19:18:10Z
David doesn't seem to be around any longer, un-assigning this.
Comment #3 by razvan.nitu1305 — 2017-08-08T09:11:43Z
How should we proceed here? Make a pull request with David's code and see what happens or close with wontfix since there is no demand for this feature?
Comment #4 by andrei — 2017-08-08T20:03:36Z
I'll close this. It's easy to get a random cover on a random-access range with replacement:
auto r1 = generate!(() => r[r.length.uniform]);
Truth be told that's an input, not a forward range but we need to find motivating applications for more elaborate approaches.