Function malachite_nz::natural::random::get_striped_random_natural_with_bits
source · pub fn get_striped_random_natural_with_bits(
xs: &mut StripedBitSource,
bits: u64,
) -> Natural
Expand description
Generates a striped random Natural
with a given bit length.
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_bits;
let mut bit_source = StripedBitSource::new(EXAMPLE_SEED, 10, 1);
// 0xbfffff80000ffc007ffe03ff8
assert_eq!(
get_striped_random_natural_with_bits(&mut bit_source, 100).to_string(),
"950737912392312175425017102328"
);