| 1 | use {Sequencerust-analyzer cargo random 0.12.2 sequence/Sequence#, Valuerust-analyzer cargo random 0.12.2 value/Value#}; |
| 2 | |
| 3 | /// A source of randomness. |
| 4 | pub trait Sourcerust-analyzer cargo random 0.12.2 source/Source# { |
| 5 | /// Read `u64` uniformly distributed over `{0, 1, …, u64::MAX}`. |
| 6 | fn read_u64rust-analyzer cargo random 0.12.2 source/Source#read_u64().(&mut self) -> u64; |
| 7 | |
| 8 | /// Read `f64` uniformly distributed over `[0, 1]`. |
| 9 | #[inline(always)] |
| 10 | fn read_f64rust-analyzer cargo random 0.12.2 source/Source#read_f64().(&mut self) -> f64 { |
| 11 | self.read_u64rust-analyzer cargo random 0.12.2 source/Source#read_u64().() as f64 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Div<Self>`]div().::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::u64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/u64/::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/u64/MAX. as f64 |
| 12 | } |
| 13 | |
| 14 | /// Read a random value. |
| 15 | #[inline(always)] |
| 16 | fn readrust-analyzer cargo random 0.12.2 source/Source#read().<V>(&mut self) -> V where Self: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, V: Valuerust-analyzer cargo random 0.12.2 value/Value# { |
| 17 | Valuerust-analyzer cargo random 0.12.2 value/Value#::readrust-analyzer cargo random 0.12.2 value/Value#read().(self) |
| 18 | } |
| 19 | |
| 20 | /// Read a sequence of random values. |
| 21 | #[inline(always)] |
| 22 | fn iterrust-analyzer cargo random 0.12.2 source/Source#iter().<'l, V>(&'l mut self) -> Sequencerust-analyzer cargo random 0.12.2 sequence/Sequence#<'l, Self, V> where Self: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, V: Valuerust-analyzer cargo random 0.12.2 value/Value# { |
| 23 | Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#::fromrust-analyzer cargo random 0.12.2 sequence/impl#[`Sequence<'l, S, V>`][`From<&'l mut S>`]from().(self) |
| 24 | } |
| 25 | } |