http://www.digitalmars.com/d/2.0/phobos/std_random.html#uniform

Above documentation  provides the following example:

        Random gen(unpredictableSeed);
        // Generate an integer in [0, 1023]
        auto a = uniform(0, 1024, gen);
        // Generate a float in [0, 1)
        auto a = uniform(0.0f, 1.0f, gen);

Which, when complied, produces the following errors:

C:\Users\Andrew\code>dmd eds32
eds32.d(9): Error: function std.random.unpredictableSeed is used as a type
eds32.d(9): Error: cannot have parameter of type void
eds32.d(10): Error: function learn.eds32.randNum.gen (void) does not match parameter types ()
eds32.d(10): Error: expected 1 function arguments, not 0
eds32.d(10): Error: template std.random.uniform(immutable(char)[] boundaries = "[)",T1,T2,UniformRandomNumberGenerator) if (is(CommonType!(T1,UniformRandomNumberGenerator) == void) && !is(CommonType!(T1,T2) == void)) does not match any function template declaration eds32.d(10): Error: template std.random.uniform(immutable(char)[] boundaries = "[)",T1,T2,UniformRandomNumberGenerator) if (is(CommonType!(T1,UniformRandomNumberGenerator) == void) && !is(CommonType!(T1,T2) == void)) cannot deduce template function from argument types !()(int,int,MersenneTwisterEngine!(uint,32,624,397,
31,-1727483681u,11,7,-1658038656u,15,-272236544u,18))

Suggest that the first line of the example be changed to:

        auto gen = Random(unpredictableSeed);

Or that a correctly working example be provided.

Andrew

Reply via email to