[Issue 4851] Three suggestions for std.random

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 23 09:45:47 PST 2013


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



--- Comment #6 from bearophile_hugs at eml.cc 2013-02-23 09:45:45 PST ---
(In reply to comment #5)

> Just for clarification. Adding
> 
> auto choice(R)(R r) { return randomSample(r, 1, r.length).front; };
> 
> would be fine?

When the input is an array (Random access range) I'd like it to use a
items[uniform(0, $)]. So it's faster for the most common use case.

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