RosettaCodeData/Task/Random-numbers/Metafont/random-numbers.metafont

20 lines
442 B
Plaintext

numeric col[];
m := 0; % m holds the mean, for testing purposes
for i = 1 upto 1000:
col[i] := 1 + .5normaldeviate;
m := m + col[i];
endfor
% testing
m := m / 1000; % finalize the computation of the mean
s := 0; % in s we compute the standard deviation
for i = 1 upto 1000:
s := s + (col[i] - m)**2;
endfor
s := sqrt(s / 1000);
show m, s; % and let's show that really they get what we wanted
end