Created
January 14, 2015 19:00
-
-
Save Prunus1350/6b6aa014a73c9d7bbee2 to your computer and use it in GitHub Desktop.
Box-Muller法によるガウス乱数の生成
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data rand_normal; | |
do i = 1 to 1000; | |
y1 = sqrt(-2 * log(rand("uniform"))) * cos(2 * constant("pi") * rand("uniform")); | |
y2 = sqrt(-2 * log(rand("uniform"))) * sin(2 * constant("pi") * rand("uniform")); | |
output; | |
end; | |
run; | |
proc sgplot data = rand_normal; | |
histogram y1; | |
run; | |
proc univariate data = rand_normal normal; | |
var y1; | |
run; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment