diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-10-10 20:18:07 +1100 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-10-23 10:40:06 +1100 |
| commit | 148f737c199a5c9dd6d349751072add3cc458533 (patch) | |
| tree | 6d11d443541b4076a8336b791fa374d00d259432 /src/rt/sync/rust_thread.cpp | |
| parent | 1420272ddc174996c532e14623d9f897ba5e7a9d (diff) | |
| download | rust-148f737c199a5c9dd6d349751072add3cc458533.tar.gz rust-148f737c199a5c9dd6d349751072add3cc458533.zip | |
std::rand: add distributions::Range for generating [lo, hi).
This reifies the computations required for uniformity done by (the old) `Rng.gen_integer_range` (now Rng.gen_range), so that they can be amortised over many invocations, if it is called in a loop. Also, it makes it correct, but using a trait + impls for each type, rather than trying to coerce `Int` + `u64` to do the right thing. This also makes it more extensible, e.g. big integers could & should implement SampleRange.
Diffstat (limited to 'src/rt/sync/rust_thread.cpp')
0 files changed, 0 insertions, 0 deletions
