[Issue 7067] std.random.RandomSample and RandomCover are poorly designed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 5 23:53:51 PST 2011


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



--- Comment #3 from bearophile_hugs at eml.cc 2011-12-05 23:53:48 PST ---
(In reply to comment #2)

> The problem with taking a random generator by reference is that it then needs
> to be escaped. So people would be quite surprised to see that:
> 
> auto gen = rndGen;
> return randomSample(a, 5, gen);
> 
> has undefined behavior.
> 
> One way or another we need to solve this, e.g. by creating a wrapper with
> reference semantics over generators. Ideas are welcome.

Turn random generators into final classes?

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