Passing a function (with arguments) as function input

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sun Apr 22 16:25:00 PDT 2012


On 23/04/12 01:19, Joseph Rushton Wakeling wrote:
> void main()
> {
>     foreach(double upper; iota(1.0, 2.0, 0.2) ) {
>         double delegate() rng = () {
>             return uniform(0.0, 1.0);
>         };
>
>         printRandomNumbers(rng,10);
>     }
> }

That was meant to be,

     double delegate() rng = () {
         return uniform(0.0, upper);
     };

... but makes little difference to the thrust of the question ;-)


More information about the Digitalmars-d-learn mailing list