fill array using a lambda function

dominic jones dominic.jones at gmx.co.uk
Thu Oct 10 06:45:47 PDT 2013


Hello,

I want to fill an array with random numbers without resorting to 
loops, i.e. by doing something like the following, if it were 
possible:

   fill!(function double(){ return uniform(0.0, 1.0);})(x[]);

Is there a simple way of doing this?

Thank you,
Dominic Jones

P.S. I am aware of the function uniformDistribution, but it makes 
the sum of the elements equal to 1, which I don't want.


More information about the Digitalmars-d-learn mailing list