]> git.lizzy.rs Git - rust.git/commit
auto merge of #10223 : huonw/rust/gamma, r=cmr
authorbors <bors@rust-lang.org>
Sat, 2 Nov 2013 01:36:42 +0000 (18:36 -0700)
committerbors <bors@rust-lang.org>
Sat, 2 Nov 2013 01:36:42 +0000 (18:36 -0700)
commitc15038db0843835bb075e2b37547e22a65604b0b
tree89b00a21b8842cdf5f9b6a8804a7ecd42bac5905
parent894c1f6398648c273043ca385f5185e49dccea08
parent3c25baa540be6186bba380e4352ef5f676deb6d6
auto merge of #10223 : huonw/rust/gamma, r=cmr

Implements the [Gamma distribution](https://en.wikipedia.org/wiki/Gamma_distribution), using the algorithm described by Marsaglia & Tsang 2000[1]. I added tests checking that the mean and variance of this implementation is as expected for a range of values of the parameters in https://github.com/huonw/random-tests/commit/5d87c00a0fb69c8fa173593714cef76ddfddb651 (they pass locally, but obviously won't even build on Travis until this is merged).

Also, moves `std::rand::distributions` to a subfolder, and performs a minor clean-up of the benchmarking (makes the number of iterations shared by the whole `std::rand` subtree).

[1]: George Marsaglia and Wai Wan Tsang. 2000. "A Simple Method for Generating Gamma Variables" *ACM Trans. Math. Softw.* 26, 3 (September 2000), 363-372. DOI:[10.1145/358407.358414](http://doi.acm.org/10.1145/358407.358414).