Task

Generate a collection filled with   1000   normally distributed random (or pseudo-random) numbers
with a mean of   1.0   and a   standard deviation   of   0.5



Many libraries only generate uniformly distributed random numbers. If so, you may use one of these algorithms.



Related task

   Standard deviation


class MAIN is
  main is
    a:ARRAY{FLTD} := #(1000);
    i:INT;
 
    RND::seed(2010);
    loop i := 1.upto!(1000) - 1;
      a[i] := 1.0d + 0.5d * RND::standard_normal;
    end;
 
    -- testing the distribution
    mean ::= a.reduce(bind(_.plus(_))) / a.size.fltd;
    #OUT + "mean " + mean + "\n";
    a.map(bind(_.minus(mean)));
    a.map(bind(_.pow(2.0d)));
    dev ::= (a.reduce(bind(_.plus(_))) / a.size.fltd).sqrt;
    #OUT + "dev  " + dev + "\n";
  end;
end;