Generate array of random values
Andrej Mitrovic
andrej.mitrovich at gmail.com
Mon Aug 1 14:35:57 PDT 2011
On 8/1/11, Adam D. Ruppe <destructionator at gmail.com> wrote:
> I'm barely following this thread, but why not:
>
> ===
> import std.random;
> void main() {
> int[] arr;
> foreach(i; 1 .. 100)
> arr ~= uniform(0, 1024);
> }
> ===
>
> ?
>
Ah but nearly every initialization can be converted to a foreach loop.
But I'm trying to avoid that and use a simple expression instead. :)
More information about the Digitalmars-d-learn
mailing list