Created
March 25, 2016 19:53
-
-
Save klgraham/1372ede72d5863231922 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
struct UniformDoubleDist: Stochastic { | |
// Returns a uniform double on [0,1] | |
func get() -> Double { | |
return drand48() | |
} | |
func sample(n: Int) -> [Double] { | |
return (1...n).map { x in get() } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment