Skip to content

Instantly share code, notes, and snippets.

@fsubal
Created December 3, 2014 10:58
Show Gist options
  • Save fsubal/6cb1eb87a5ea096b57a4 to your computer and use it in GitHub Desktop.
Save fsubal/6cb1eb87a5ea096b57a4 to your computer and use it in GitHub Desktop.
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