On Tuesday, 26 April 2016 at 10:50:27 UTC, Nordlöw wrote:
On Tuesday, 26 April 2016 at 10:31:22 UTC, Nordlöw wrote:
How do I lazily generate a sequence of random instances of type `T` as an `InputRange`?

Ahh, I found it:

        import std.range : generate, take;
        import std.random : uniform;
auto randomSamples = generate!(() => uniform!Key).take(n);

I should have guessed that...

Btw if you do random generation at the moment, you should always be aware that it's super-easy to do an implicit copy if you pass around the rndGen, see:

http://dconf.org/2015/talks/wakeling.html

Reply via email to