Skip to content

Instantly share code, notes, and snippets.

@klgraham
Created March 25, 2016 19:53
Show Gist options
  • Save klgraham/1372ede72d5863231922 to your computer and use it in GitHub Desktop.
Save klgraham/1372ede72d5863231922 to your computer and use it in GitHub Desktop.
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