Generate array of random values

Dmitry Olshansky dmitry.olsh at gmail.com
Tue Aug 2 05:17:47 PDT 2011


On 02.08.2011 16:08, Andrej Mitrovic wrote:
> On 8/2/11, Pelle<pelle.mansson at gmail.com>  wrote:
>> Without UFCS, well, how would you want it to look?
> Maybe..
>
> auto max = 1024;
> auto len = 1024;
>
> arr = rndRange(max)[0..len];
>
> IOW, using the slice operator instead of a call to array().
It could be done , but IMO a lot of generic code would totally expect 
slice to
1. return the same type as the range itself (or 100% compatible)
2. most of the time not to allocate

-- 
Dmitry Olshansky



More information about the Digitalmars-d-learn mailing list