Re: random number generation

Posted by Andy W on
URL: http://spssx-discussion.165.s1.nabble.com/random-number-generation-tp5719063p5740970.html

One way to do it, truncate to integers over 1-32 [note exactly 33 should never happen in rv.uniform(1,33)], and then divide by 2. Upped the number of simulated draws to show it is approximately is uniform as expected.

*************************.
input program.
loop #i = 1 to 1e6.
- compute X =trunc(rv.univorm (1,33))/2.
- end case.
end loop.
end file.
end input program.
frequencies X.
*************************.
Andy W
apwheele@gmail.com
http://andrewpwheeler.wordpress.com/