Generate array of random values

bearophile bearophileHUGS at lycos.com
Tue Aug 2 06:21:35 PDT 2011


Andrej Mitrovic:

> Maybe..
> 
> auto max = 1024;
> auto len = 1024;
> 
> arr = rndRange(max)[0..len];

In my opinion that's not general enough for Phobos, see the N dimensional table() I have explained here:
auto arr = table!q{ uniform(0, 1024) }(1024);

http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D.learn&article_id=28543

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list