Trait num_bigint::RandBigInt

source ·
pub trait RandBigInt {
    // Required methods
    fn gen_biguint(&mut self, bit_size: u64) -> BigUint;
    fn gen_bigint(&mut self, bit_size: u64) -> BigInt;
    fn gen_biguint_below(&mut self, bound: &BigUint) -> BigUint;
    fn gen_biguint_range(
        &mut self,
        lbound: &BigUint,
        ubound: &BigUint,
    ) -> BigUint;
    fn gen_bigint_range(&mut self, lbound: &BigInt, ubound: &BigInt) -> BigInt;
}
Available on crate feature rand only.
Expand description

A trait for sampling random big integers.

The rand feature must be enabled to use this. See crate-level documentation for details.

Required Methods§

source

fn gen_biguint(&mut self, bit_size: u64) -> BigUint

Generate a random BigUint of the given bit size.

source

fn gen_bigint(&mut self, bit_size: u64) -> BigInt

Generate a random BigInt` of the given bit size.

source

fn gen_biguint_below(&mut self, bound: &BigUint) -> BigUint

Generate a random BigUint less than the given bound. Fails when the bound is zero.

source

fn gen_biguint_range(&mut self, lbound: &BigUint, ubound: &BigUint) -> BigUint

Generate a random BigUint within the given range. The lower bound is inclusive; the upper bound is exclusive. Fails when the upper bound is not greater than the lower bound.

source

fn gen_bigint_range(&mut self, lbound: &BigInt, ubound: &BigInt) -> BigInt

Generate a random BigInt within the given range. The lower bound is inclusive; the upper bound is exclusive. Fails when the upper bound is not greater than the lower bound.

Implementors§

source§

impl<R: Rng + ?Sized> RandBigInt for R