std.random:uniform - uncompilable example from docs

Christopher Wright dhasenan at gmail.com
Sun May 10 07:04:17 PDT 2009


Tyro[a.c.edwards] wrote:
> 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:

It would be cool if DDoc could incorporate unittest examples -- it's in 
a doc comment and a unittest, changes automatically propagated between 
the two, so if your unittest succeeds, the documentation is probably at 
least somewhat correct.


More information about the Digitalmars-d-learn mailing list