16 lines
425 B
Plaintext
16 lines
425 B
Plaintext
;;; Choose radians as arguments to trigonometic functions
|
|
true -> popradians;
|
|
|
|
;;; procedure generating standard normal distribution
|
|
define random_normal() -> result;
|
|
lvars r1 = random0(1.0), r2 = random0(1.0);
|
|
cos(2*pi*r1)*sqrt(-2*log(r2)) -> result
|
|
enddefine;
|
|
|
|
lvars array, i;
|
|
|
|
;;; Put numbers on the stack
|
|
for i from 1 to 1000 do 1.0+0.5*random_normal() endfor;
|
|
;;; collect them into array
|
|
consvector(1000) -> array;
|