Function malachite_base::num::random::striped::striped_random_negative_signeds
source · pub fn striped_random_negative_signeds<T: PrimitiveSigned>(
seed: Seed,
m_numerator: u64,
m_denominator: u64
) -> StripedRandomNegativeSigneds<T> ⓘ
Expand description
Generates random negative signed integers from a random striped distribution.
See here for more information.
The mean run length (before the bit sequences are truncated) is
$m$ = m_numerator / m_denominator
.
The output length is infinite.
Expected complexity per iteration
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and n
is the width of the type.
Panics
Panics if m_denominator
is zero or if m_numerator <= m_denominator.
Examples
use malachite_base::iterators::prefix_to_string;
use malachite_base::num::random::striped::striped_random_negative_signeds;
use malachite_base::random::EXAMPLE_SEED;
use malachite_base::strings::ToBinaryString;
assert_eq!(
prefix_to_string(
striped_random_negative_signeds::<i8>(EXAMPLE_SEED, 4, 1)
.map(|x| x.to_binary_string()),
10
),
"[10000000, 10101100, 10110000, 11111100, 10001111, 11111110, 10000000, 10000111, \
10011101, 11100000, ...]"
)