Struct valence::rand::distributions::uniform::UniformInt
source · pub struct UniformInt<X> { /* private fields */ }
Expand description
The back-end implementing UniformSampler
for integer types.
Unless you are implementing UniformSampler
for your own type, this type
should not be used directly, use Uniform
instead.
§Implementation notes
For simplicity, we use the same generic struct UniformInt<X>
for all
integer types X
. This gives us only one field type, X
; to store unsigned
values of this size, we take use the fact that these conversions are no-ops.
For a closed range, the number of possible numbers we should generate is
range = (high - low + 1)
. To avoid bias, we must ensure that the size of
our sample space, zone
, is a multiple of range
; other values must be
rejected (by replacing with a new random sample).
As a special case, we use range = 0
to represent the full range of the
result type (i.e. for new_inclusive($ty::MIN, $ty::MAX)
).
The optimum zone
is the largest product of range
which fits in our
(unsigned) target type. We calculate this by calculating how many numbers we
must reject: reject = (MAX + 1) % range = (MAX - range + 1) % range
. Any (large)
product of range
will suffice, thus in sample_single
we multiply by a
power of 2 via bit-shifting (faster but may cause more rejections).
The smallest integer PRNGs generate is u32
. For 8- and 16-bit outputs we
use u32
for our zone
and samples (because it’s not slower and because
it reduces the chance of having to reject a sample). In this case we cannot
store zone
in the target type since it is too large, however we know
ints_to_reject < range <= $unsigned::MAX
.
An alternative to using a modulus is widening multiply: After a widening
multiply by range
, the result is in the high word. Then comparing the low
word against zone
makes sure our distribution is uniform.
Trait Implementations§
source§impl<X> Clone for UniformInt<X>where
X: Clone,
impl<X> Clone for UniformInt<X>where
X: Clone,
source§fn clone(&self) -> UniformInt<X>
fn clone(&self) -> UniformInt<X>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<X> Debug for UniformInt<X>where
X: Debug,
impl<X> Debug for UniformInt<X>where
X: Debug,
source§impl<X> PartialEq for UniformInt<X>where
X: PartialEq,
impl<X> PartialEq for UniformInt<X>where
X: PartialEq,
source§impl UniformSampler for UniformInt<i128>
impl UniformSampler for UniformInt<i128>
source§fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i128>where
B1: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i128>where
B1: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
[low, high)
. Read moresource§fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i128>where
B1: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i128>where
B1: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
[low, high]
. Read moresource§fn sample<R>(&self, rng: &mut R) -> <UniformInt<i128> as UniformSampler>::X
fn sample<R>(&self, rng: &mut R) -> <UniformInt<i128> as UniformSampler>::X
source§fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i128> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i128> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
[low, high)
. Read moresource§fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i128> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i128> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i128> as UniformSampler>::X>,
[low, high]
. Read moresource§impl UniformSampler for UniformInt<i16>
impl UniformSampler for UniformInt<i16>
source§fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i16>where
B1: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i16>where
B1: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
[low, high)
. Read moresource§fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i16>where
B1: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i16>where
B1: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
[low, high]
. Read moresource§fn sample<R>(&self, rng: &mut R) -> <UniformInt<i16> as UniformSampler>::X
fn sample<R>(&self, rng: &mut R) -> <UniformInt<i16> as UniformSampler>::X
source§fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i16> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i16> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
[low, high)
. Read moresource§fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i16> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i16> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i16> as UniformSampler>::X>,
[low, high]
. Read moresource§impl UniformSampler for UniformInt<i32>
impl UniformSampler for UniformInt<i32>
source§fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i32>where
B1: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i32>where
B1: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
[low, high)
. Read moresource§fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i32>where
B1: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i32>where
B1: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
[low, high]
. Read moresource§fn sample<R>(&self, rng: &mut R) -> <UniformInt<i32> as UniformSampler>::X
fn sample<R>(&self, rng: &mut R) -> <UniformInt<i32> as UniformSampler>::X
source§fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i32> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i32> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
[low, high)
. Read moresource§fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i32> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i32> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i32> as UniformSampler>::X>,
[low, high]
. Read moresource§impl UniformSampler for UniformInt<i64>
impl UniformSampler for UniformInt<i64>
source§fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i64>where
B1: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i64>where
B1: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
[low, high)
. Read moresource§fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i64>where
B1: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i64>where
B1: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
[low, high]
. Read moresource§fn sample<R>(&self, rng: &mut R) -> <UniformInt<i64> as UniformSampler>::X
fn sample<R>(&self, rng: &mut R) -> <UniformInt<i64> as UniformSampler>::X
source§fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i64> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i64> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
[low, high)
. Read moresource§fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i64> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i64> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i64> as UniformSampler>::X>,
[low, high]
. Read moresource§impl UniformSampler for UniformInt<i8>
impl UniformSampler for UniformInt<i8>
source§fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i8>where
B1: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i8>where
B1: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
[low, high)
. Read moresource§fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i8>where
B1: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<i8>where
B1: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
[low, high]
. Read moresource§fn sample<R>(&self, rng: &mut R) -> <UniformInt<i8> as UniformSampler>::X
fn sample<R>(&self, rng: &mut R) -> <UniformInt<i8> as UniformSampler>::X
source§fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i8> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i8> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
[low, high)
. Read moresource§fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i8> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<i8> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<i8> as UniformSampler>::X>,
[low, high]
. Read moresource§impl UniformSampler for UniformInt<isize>
impl UniformSampler for UniformInt<isize>
source§fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<isize>where
B1: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<isize>where
B1: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
[low, high)
. Read moresource§fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<isize>where
B1: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<isize>where
B1: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
[low, high]
. Read moresource§fn sample<R>(&self, rng: &mut R) -> <UniformInt<isize> as UniformSampler>::X
fn sample<R>(&self, rng: &mut R) -> <UniformInt<isize> as UniformSampler>::X
source§fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<isize> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<isize> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
[low, high)
. Read moresource§fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<isize> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<isize> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<isize> as UniformSampler>::X>,
[low, high]
. Read moresource§impl UniformSampler for UniformInt<u128>
impl UniformSampler for UniformInt<u128>
source§fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u128>where
B1: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u128>where
B1: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
[low, high)
. Read moresource§fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u128>where
B1: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u128>where
B1: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
[low, high]
. Read moresource§fn sample<R>(&self, rng: &mut R) -> <UniformInt<u128> as UniformSampler>::X
fn sample<R>(&self, rng: &mut R) -> <UniformInt<u128> as UniformSampler>::X
source§fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u128> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u128> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
[low, high)
. Read moresource§fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u128> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u128> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u128> as UniformSampler>::X>,
[low, high]
. Read moresource§impl UniformSampler for UniformInt<u16>
impl UniformSampler for UniformInt<u16>
source§fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u16>where
B1: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u16>where
B1: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
[low, high)
. Read moresource§fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u16>where
B1: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u16>where
B1: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
[low, high]
. Read moresource§fn sample<R>(&self, rng: &mut R) -> <UniformInt<u16> as UniformSampler>::X
fn sample<R>(&self, rng: &mut R) -> <UniformInt<u16> as UniformSampler>::X
source§fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u16> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u16> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
[low, high)
. Read moresource§fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u16> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u16> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u16> as UniformSampler>::X>,
[low, high]
. Read moresource§impl UniformSampler for UniformInt<u32>
impl UniformSampler for UniformInt<u32>
source§fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u32>where
B1: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u32>where
B1: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
[low, high)
. Read moresource§fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u32>where
B1: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u32>where
B1: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
[low, high]
. Read moresource§fn sample<R>(&self, rng: &mut R) -> <UniformInt<u32> as UniformSampler>::X
fn sample<R>(&self, rng: &mut R) -> <UniformInt<u32> as UniformSampler>::X
source§fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u32> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u32> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
[low, high)
. Read moresource§fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u32> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u32> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u32> as UniformSampler>::X>,
[low, high]
. Read moresource§impl UniformSampler for UniformInt<u64>
impl UniformSampler for UniformInt<u64>
source§fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u64>where
B1: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u64>where
B1: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
[low, high)
. Read moresource§fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u64>where
B1: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u64>where
B1: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
[low, high]
. Read moresource§fn sample<R>(&self, rng: &mut R) -> <UniformInt<u64> as UniformSampler>::X
fn sample<R>(&self, rng: &mut R) -> <UniformInt<u64> as UniformSampler>::X
source§fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u64> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u64> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
[low, high)
. Read moresource§fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u64> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u64> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u64> as UniformSampler>::X>,
[low, high]
. Read moresource§impl UniformSampler for UniformInt<u8>
impl UniformSampler for UniformInt<u8>
source§fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u8>where
B1: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u8>where
B1: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
[low, high)
. Read moresource§fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u8>where
B1: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<u8>where
B1: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
[low, high]
. Read moresource§fn sample<R>(&self, rng: &mut R) -> <UniformInt<u8> as UniformSampler>::X
fn sample<R>(&self, rng: &mut R) -> <UniformInt<u8> as UniformSampler>::X
source§fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u8> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u8> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
[low, high)
. Read moresource§fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u8> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<u8> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<u8> as UniformSampler>::X>,
[low, high]
. Read moresource§impl UniformSampler for UniformInt<usize>
impl UniformSampler for UniformInt<usize>
source§fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<usize>where
B1: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
fn new<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<usize>where
B1: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
[low, high)
. Read moresource§fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<usize>where
B1: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
fn new_inclusive<B1, B2>(low_b: B1, high_b: B2) -> UniformInt<usize>where
B1: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
[low, high]
. Read moresource§fn sample<R>(&self, rng: &mut R) -> <UniformInt<usize> as UniformSampler>::X
fn sample<R>(&self, rng: &mut R) -> <UniformInt<usize> as UniformSampler>::X
source§fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<usize> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
fn sample_single<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<usize> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
[low, high)
. Read moresource§fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<usize> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
fn sample_single_inclusive<R, B1, B2>(
low_b: B1,
high_b: B2,
rng: &mut R,
) -> <UniformInt<usize> as UniformSampler>::Xwhere
R: Rng + ?Sized,
B1: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
B2: SampleBorrow<<UniformInt<usize> as UniformSampler>::X>,
[low, high]
. Read moreimpl<X> Copy for UniformInt<X>where
X: Copy,
impl<X> StructuralPartialEq for UniformInt<X>
Auto Trait Implementations§
impl<X> Freeze for UniformInt<X>where
X: Freeze,
impl<X> RefUnwindSafe for UniformInt<X>where
X: RefUnwindSafe,
impl<X> Send for UniformInt<X>where
X: Send,
impl<X> Sync for UniformInt<X>where
X: Sync,
impl<X> Unpin for UniformInt<X>where
X: Unpin,
impl<X> UnwindSafe for UniformInt<X>where
X: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.§fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
fn fmt_list(self) -> FmtList<Self>where
&'a Self: for<'a> IntoIterator,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.