20 lines
467 B
Plaintext
20 lines
467 B
Plaintext
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;
|