pub fn get_striped_random_natural_with_up_to_bits(
xs: &mut StripedBitSource,
bits: u64
) -> Natural
Expand description
Generates a striped random Natural
with a given maximum bit length.
Natural
s with bit lengths smaller than the maximum may also be generated.
See StripedBitSource
for information about generating striped random numbers.
§Expected complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and n
is bits
.
§Examples
use malachite_base::num::random::striped::StripedBitSource;
use malachite_base::random::EXAMPLE_SEED;
use malachite_nz::natural::random::get_striped_random_natural_with_up_to_bits;
let mut bit_source = StripedBitSource::new(EXAMPLE_SEED, 10, 1);
// 0x3fffff80000ffc007ffe03ff8
assert_eq!(
get_striped_random_natural_with_up_to_bits(&mut bit_source, 100).to_string(),
"316912612278197474676665499640"
);