On 08/07/2015 06:59 AM, drug wrote:
What is the best way to create range from uniform() function (in other
words create a generator based on some function, returning, say, scalar,
not range)? I did http://dpaste.dzfl.pl/53e3d9255cd7 but I'm not sure
it's the best way. At least sequence using looks ugly
There is an undocumented (why?) Generator struct and generate() functin
in std.range:
import std.stdio;
import std.range;
import std.random;
void main()
{
auto r = generate!(() => uniform(0, 6))
.take(10);
writefln("%(%s %)", r);
}
Ali