Struct dashu_int::rand::UniformIBig
source · [−]pub struct UniformIBig { /* private fields */ }
Expand description
Uniform IBig distribution.
Example
use dashu_int::ibig;
use rand::{distributions::uniform::Uniform, thread_rng, Rng};
let a = thread_rng().gen_range(ibig!(3)..ibig!(10));
let b = thread_rng().sample(Uniform::new(ibig!(-5), &a));
assert!(a >= ibig!(3) && a < ibig!(10));
assert!(b >= ibig!(-5) && b < a);
Trait Implementations
sourceimpl UniformSampler for UniformIBig
impl UniformSampler for UniformIBig
sourcefn new<B1, B2>(low: B1, high: B2) -> UniformIBig where
B1: SampleBorrow<IBig>,
B2: SampleBorrow<IBig>,
fn new<B1, B2>(low: B1, high: B2) -> UniformIBig where
B1: SampleBorrow<IBig>,
B2: SampleBorrow<IBig>,
Construct self, with inclusive lower bound and exclusive upper bound
[low, high)
. Read more
sourcefn new_inclusive<B1, B2>(low: B1, high: B2) -> UniformIBig where
B1: SampleBorrow<IBig>,
B2: SampleBorrow<IBig>,
fn new_inclusive<B1, B2>(low: B1, high: B2) -> UniformIBig where
B1: SampleBorrow<IBig>,
B2: SampleBorrow<IBig>,
Construct self, with inclusive bounds [low, high]
. Read more
sourcefn sample_single<R, B1, B2>(low: B1, high: B2, rng: &mut R) -> Self::X where
R: Rng + ?Sized,
B1: SampleBorrow<Self::X>,
B2: SampleBorrow<Self::X>,
fn sample_single<R, B1, B2>(low: B1, high: B2, rng: &mut R) -> Self::X where
R: Rng + ?Sized,
B1: SampleBorrow<Self::X>,
B2: SampleBorrow<Self::X>,
Sample a single value uniformly from a range with inclusive lower bound
and exclusive upper bound [low, high)
. Read more
sourcefn sample_single_inclusive<R, B1, B2>(low: B1, high: B2, rng: &mut R) -> Self::X where
R: Rng + ?Sized,
B1: SampleBorrow<Self::X>,
B2: SampleBorrow<Self::X>,
fn sample_single_inclusive<R, B1, B2>(low: B1, high: B2, rng: &mut R) -> Self::X where
R: Rng + ?Sized,
B1: SampleBorrow<Self::X>,
B2: SampleBorrow<Self::X>,
Sample a single value uniformly from a range with inclusive lower bound
and inclusive upper bound [low, high]
. Read more
Auto Trait Implementations
impl RefUnwindSafe for UniformIBig
impl Send for UniformIBig
impl Sync for UniformIBig
impl Unpin for UniformIBig
impl UnwindSafe for UniformIBig
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more