Trait num_bigint_dig::RandPrime
source · pub trait RandPrime {
// Required method
fn gen_prime(&mut self, bits: usize) -> BigUint;
}
Expand description
A generic trait for generating random primes.
Warning: This is highly dependend on the provided random number generator, to provide actually random primes.
Example
extern crate rand;
extern crate num_bigint_dig as num_bigint;
use rand::thread_rng;
use num_bigint::RandPrime;
let mut rng = thread_rng();
let p = rng.gen_prime(1024);
assert_eq!(p.bits(), 1024);