Created
December 3, 2014 10:58
-
-
Save fsubal/6cb1eb87a5ea096b57a4 to your computer and use it in GitHub Desktop.
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
def regRnd(n:Int):Number = { | |
val s = for{i <- 1 to n} yield Math.random() | |
s.reduce(_ + _).toDouble / n | |
} | |
//Box-Muller's Method | |
regRnd(12) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment