use crate;
use crate;
use crate PrimitiveSigned;
use crate PrimitiveUnsigned;
use crate;
use crate;
use crate;
use crate Seed;
use Itertools;
use ;
use PhantomData;
/// Generates bits from a striped random sequence.
///
/// See [here](self) for more information.
/// Generates random unsigned integers from a random striped distribution.
///
/// This `struct` is created by [`striped_random_unsigned_bit_chunks`]; see its documentation for
/// more.
/// Generates random signed integers from a random striped distribution.
///
/// This `struct` is created by [`striped_random_signeds`]; see its documentation for more.
/// Generates random natural (non-negative) signed integers from a random striped distribution.
///
/// This `struct` is created by [`striped_random_natural_signeds`]; see its documentation for more.
/// Generates random negative signed integers from a random striped distribution.
///
/// This `struct` is created by [`striped_random_negative_signeds`]; see its documentation for
/// more.
/// Generates random unsigned integers less than a positive limit, from a random striped
/// distribution.
///
/// This `struct` is created by [`striped_random_unsigneds_less_than`]; see its documentation for
/// more.
/// Generates random unsigned integers from a random striped distribution.
///
/// See [here](self) 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_unsigneds;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_unsigneds::<u8>(EXAMPLE_SEED, 4, 1).map(|x| x.to_binary_string()),
/// 10
/// ),
/// "[1, 1001100, 1111111, 11000011, 0, 10000000, 1111, 1110110, 0, 11111000, ...]"
/// )
/// ```
/// Generates random positive unsigned integers from a random striped distribution.
///
/// See [here](self) 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_positive_unsigneds;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_positive_unsigneds::<u8>(EXAMPLE_SEED, 4, 1)
/// .map(|x| x.to_binary_string()),
/// 10
/// ),
/// "[1, 1001100, 1111111, 11000011, 10000000, 1111, 1110110, 11111000, 11111111, 11111101, \
/// ...]"
/// )
/// ```
/// Generates random signed integers from a random striped distribution.
///
/// See [here](self) 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_signeds;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_signeds::<i8>(EXAMPLE_SEED, 4, 1).map(|x| x.to_binary_string()),
/// 10
/// ),
/// "[1100001, 1000000, 1100000, 10000111, 1111, 10000001, 1111000, 100011, 111101, 11111100, \
/// ...]"
/// )
/// ```
/// Generates random natural (non-negative) signed integers from a random striped distribution.
///
/// See [here](self) 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_natural_signeds;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_natural_signeds::<i8>(EXAMPLE_SEED, 4, 1).map(|x| x.to_binary_string()),
/// 10
/// ),
/// "[0, 101100, 110000, 1111100, 1111, 1111110, 0, 111, 11101, 1100000, ...]"
/// )
/// ```
/// Generates random positive signed integers from a random striped distribution.
///
/// See [here](self) 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_positive_signeds;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_positive_signeds::<i8>(EXAMPLE_SEED, 4, 1)
/// .map(|x| x.to_binary_string()),
/// 10
/// ),
/// "[101100, 110000, 1111100, 1111, 1111110, 111, 11101, 1100000, 1111111, 1100000, ...]"
/// )
/// ```
/// Generates random negative signed integers from a random striped distribution.
///
/// See [here](self) 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, ...]"
/// )
/// ```
/// Generates random nonzero signed integers from a random striped distribution.
///
/// See [here](self) 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_nonzero_signeds;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_nonzero_signeds::<i8>(EXAMPLE_SEED, 4, 1).map(|x| x.to_binary_string()),
/// 10
/// ),
/// "[1100001, 1000000, 1100000, 10000111, 1111, 10000001, 1111000, 100011, 111101, 11111100, \
/// ...]"
/// )
/// ```
/// Generates random unsigned integers of up to `chunk_size` bits from a random striped
/// distribution.
///
/// See [here](self) 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 `chunk_size`.
///
/// # Panics
/// Panics if `m_denominator` is zero, if m_numerator <= m_denominator, or if `chunk_size` is
/// greater than the width of the type.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_unsigned_bit_chunks;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_unsigned_bit_chunks::<u8>(EXAMPLE_SEED, 3, 4, 1)
/// .map(|x| x.to_binary_string()),
/// 10
/// ),
/// "[0, 0, 0, 101, 11, 100, 11, 11, 0, 111, ...]"
/// )
/// ```
/// Generates a striped `Vec<bool>`, with a given length, from a [`StripedBitSource`].
///
/// See [here](self) for more information.
///
/// The output length is `len`.
///
/// # Expected complexity
/// $T(n) = O(n)$
///
/// $M(n) = O(n)$
///
/// where $T$ is time, $M$ is additional memory, and `n` is `len`.
///
/// # Examples
/// ```
/// use malachite_base::num::random::striped::{get_striped_bool_vec, StripedBitSource};
/// use malachite_base::random::EXAMPLE_SEED;
///
/// let mut bit_source = StripedBitSource::new(EXAMPLE_SEED, 10, 1);
/// let bits: String = get_striped_bool_vec(&mut bit_source, 50)
/// .into_iter()
/// .map(|b| if b { '1' } else { '0' })
/// .collect();
/// assert_eq!(bits, "00011111111111000000011111111111111000000000001111");
/// ```
/// Generates random striped `Vec<bool>`s.
/// Generates random striped `Vec<bool>`s, with lengths from an iterator.
///
/// See [here](self) for more information.
///
/// The mean run length (before the bit sequences are truncated) is
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// # Panics
/// Panics if `mean_stripe_denominator` is zero or if
/// `mean_stripe_numerator <= mean_stripe_denominator`.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_bool_vecs_from_length_iterator;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
/// use malachite_base::vecs::random_values_from_vec;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_bool_vecs_from_length_iterator(
/// EXAMPLE_SEED,
/// &|seed| random_values_from_vec(seed, vec![0, 2, 4]),
/// 10,
/// 1,
/// ).map(|bs| bs.into_iter().map(|b| if b { '1' } else { '0' }).collect::<String>()),
/// 20
/// ),
/// "[00, 0000, 00, 0000, 0000, 11, , 00, , 1111, 0001, 11, 1100, 00, 0000, 0000, 1110, , \
/// 0000, , ...]"
/// );
/// ```
/// Generates random striped `Vec<bool>`s of a given length.
///
/// See [here](self) for more information.
///
/// The mean run length (before the bit sequences are truncated) is
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// If `len` is 0, the output consists of the empty list, repeated.
///
/// # Expected complexity per iteration
/// $T(n) = O(n)$
///
/// $M(n) = O(n)$
///
/// where $T$ is time, $M$ is additional memory, and $n$ is `len`.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_fixed_length_bool_vecs;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_fixed_length_bool_vecs(EXAMPLE_SEED, 5, 10, 1)
/// .map(
/// |bs| bs.into_iter().map(|b| if b { '1' } else { '0' }).collect::<String>()
/// ),
/// 20
/// ),
/// "[00000, 00000, 00000, 00000, 00011, 11000, 00000, 11111, 01111, 11111, 10000, 00011, \
/// 00000, 00000, 11000, 00000, 11111, 00000, 00000, 11111, ...]"
/// );
/// ```
/// Generates random striped `Vec<bool>`s.
///
/// See [here](self) for more information.
///
/// The lengths of the [`Vec`]s are sampled from a geometric distribution with a specified mean
/// $m$, equal to `mean_length_numerator / mean_length_denominator`. $m$ must be greater than 0.
///
/// The mean run length (before the bit sequences are truncated) is
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// # Expected complexity per iteration
/// $T(n) = O(n)$
///
/// $M(n) = O(n)$
///
/// where $T$ is time, $M$ is additional memory, and $n$ is
/// `mean_length_numerator / mean_length_denominator`.
///
/// # Panics
/// Panics if `mean_stripe_denominator` is zero, if
/// `mean_stripe_numerator <= mean_stripe_denominator`, if `mean_length_numerator` or
/// `mean_length_denominator` are zero, or, if after being reduced to lowest terms, their sum is
/// greater than or equal to $2^{64}$.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_bool_vecs;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_bool_vecs(EXAMPLE_SEED, 10, 1, 2, 1)
/// .map(
/// |bs| bs.into_iter().map(|b| if b { '1' } else { '0' }).collect::<String>()
/// ),
/// 20
/// ),
/// "[000000, 0, 00000000, 0, 00000001110000, , 11111, 0000, 1, , 011111, 11, , , 1, 000, , \
/// 0, , 0, ...]"
/// );
/// ```
/// Generates random striped `Vec<bool>`s, with a minimum length.
///
/// See [here](self) for more information.
///
/// The lengths of the [`Vec`]s are sampled from a geometric distribution with a specified mean
/// $m$, equal to `mean_length_numerator / mean_length_denominator`. $m$ must be greater than
/// `min_length`.
///
/// The mean run length (before the bit sequences are truncated) is
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// # Expected complexity per iteration
/// $T(n) = O(n)$
///
/// $M(n) = O(n)$
///
/// where $T$ is time, $M$ is additional memory, and $n$ is
/// `mean_length_numerator / mean_length_denominator`.
///
/// # Panics
/// Panics if `mean_stripe_denominator` is zero, if
/// `mean_stripe_numerator <= mean_stripe_denominator`, if `mean_length_numerator` or
/// `mean_length_denominator` are zero, if their ratio is less than or equal to `min_length`, or if
/// they are too large and manipulating them leads to arithmetic overflow.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_bool_vecs_min_length;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_bool_vecs_min_length(EXAMPLE_SEED, 3, 10, 1, 5, 1)
/// .map(
/// |bs| bs.into_iter().map(|b| if b { '1' } else { '0' }).collect::<String>()
/// ),
/// 20
/// ),
/// "[000000000, 0000, 00000000111, 0111, 00000000011111111, 100, 00000111, 1111111, 0001, \
/// 111, 111111111, 00000, 000, 000, 1111, 000000, 111, 0011, 000, 1111, ...]"
/// );
/// ```
/// Generates random striped `Vec<bool>`s, with lengths in $[a, b)$.
///
/// See [here](self) for more information.
///
/// The lengths of the [`Vec`]s are sampled from a uniform distribution on $[a, b)$. $a$ must be
/// less than $b$.
///
/// The mean run length (before the bit sequences are truncated) is
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// $$
/// P((x_0, x_1, \ldots, x_{n-1})) = \\begin{cases}
/// \frac{1}{b-a}\prod_{i=0}^{n-1}P(x_i) & \text{if} \\quad a \leq n < b, \\\\
/// 0 & \\text{otherwise}.
/// \\end{cases}
/// $$
///
/// # Expected complexity per iteration
/// $T(n) = O(b)$
///
/// $M(n) = O(b)$
///
/// where $T$ is time and $M$ is additional memory.
///
/// # Panics
/// Panics if `mean_stripe_denominator` is zero, if
/// `mean_stripe_numerator <= mean_stripe_denominator`, or if $a \geq b$.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_bool_vecs_length_range;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_bool_vecs_length_range(EXAMPLE_SEED, 4, 10, 10, 1)
/// .map(
/// |bs| bs.into_iter().map(|b| if b { '1' } else { '0' }).collect::<String>()
/// ),
/// 20
/// ),
/// "[000000000, 000000000, 000111000, 000000000, 0111, 11111, 00111111, 1000000, 00000011, \
/// 111111111, 111111, 00000000, 00000000, 001111, 111111111, 000000000, 110000, 0001111, \
/// 0000000, 111101111, ...]"
/// );
/// ```
/// Generates random striped `Vec<bool>`s, with lengths in $[a, b]$.
///
/// See [here](self) for more information.
///
/// The lengths of the [`Vec`]s are sampled from a uniform distribution on $[a, b]$. $a$ must be
/// less than $b$.
///
/// The mean run length (before the bit sequences are truncated) is
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// $$
/// P((x_0, x_1, \ldots, x_{n-1})) = \\begin{cases}
/// \frac{1}{b-a+1}\prod_{i=0}^{n-1}P(x_i) & \text{if} \\quad a \leq n \leq b, \\\\
/// 0 & \\text{otherwise}.
/// \\end{cases}
/// $$
///
/// # Expected complexity per iteration
/// $T(n) = O(b)$
///
/// $M(n) = O(b)$
///
/// where $T$ is time and $M$ is additional memory.
///
/// # Panics
/// Panics if `mean_stripe_denominator` is zero, if
/// `mean_stripe_numerator <= mean_stripe_denominator`, or if $a \geq b$.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_bool_vecs_length_inclusive_range;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_bool_vecs_length_inclusive_range(EXAMPLE_SEED, 4, 9, 10, 1)
/// .map(
/// |bs| bs.into_iter().map(|b| if b { '1' } else { '0' }).collect::<String>()
/// ),
/// 20
/// ),
/// "[000000000, 000000000, 000111000, 000000000, 0111, 11111, 00111111, 1000000, 00000011, \
/// 111111111, 111111, 00000000, 00000000, 001111, 111111111, 000000000, 110000, 0001111, \
/// 0000000, 111101111, ...]"
/// );
/// ```
/// Generates a striped unsigned [`Vec`], with a given number of bits (not length!), from a
/// [`StripedBitSource`].
///
/// See [here](self) for more information.
///
/// The output length is `bit_len.div_round(T::WIDTH, RoundingMode::Ceiling)`.
///
/// # Expected complexity
/// $T(n) = O(n)$
///
/// $M(n) = O(n)$
///
/// where $T$ is time, $M$ is additional memory, and $n$ is `bit_len`.
///
/// # Examples
/// ```
/// use itertools::Itertools;
/// use malachite_base::num::random::striped::{get_striped_unsigned_vec, StripedBitSource};
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// let mut bit_source = StripedBitSource::new(EXAMPLE_SEED, 10, 1);
/// let xs = get_striped_unsigned_vec::<u8>(&mut bit_source, 100)
/// .iter()
/// .map(u8::to_binary_string)
/// .collect_vec();
/// assert_eq!(
/// xs,
/// &[
/// "11111000", "111111", "11100000", "11111111", "111", "11000000", "11111111", "0", "0",
/// "11111000", "11111111", "11111111", "11",
/// ]
/// );
/// ```
/// Generates random striped [`Vec`]s of unsigneds.
/// Generates random striped [`Vec`]s of unsigneds, with lengths from an iterator.
///
/// See [here](self) for more information.
///
/// The mean run length (before the bit sequences are truncated) is
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// # Panics
/// Panics if `mean_stripe_denominator` is zero or if
/// `mean_stripe_numerator <= mean_stripe_denominator`.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_unsigned_vecs_from_length_iterator;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::{ToBinaryString, ToDebugString};
/// use malachite_base::vecs::random_values_from_vec;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_unsigned_vecs_from_length_iterator::<u8, _>(
/// EXAMPLE_SEED,
/// &|seed| random_values_from_vec(seed, vec![0, 2, 4]),
/// 10,
/// 1,
/// ).map(|xs| prefix_to_string(xs.into_iter().map(|x: u8| x.to_binary_string()), 100)),
/// 10,
/// ),
/// "[[0, 0], [1110000, 0, 11111100, 11], [11111110, 1111], [0, 0, 0, 11111000], \
/// [0, 0, 1111110, 0], [11011111, 11111111], [], [11110000, 11111111], [], \
/// [11111111, 11000011, 11111, 0], ...]"
/// );
/// ```
/// Generates random striped unsigned [`Vec`]s of a given length.
///
/// See [here](self) for more information.
///
/// The mean run length (before the bit sequences are truncated) is
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// If `len` is 0, the output consists of the empty list, repeated.
///
/// # Expected complexity per iteration
/// $T(n) = O(n)$
///
/// $M(n) = O(n)$
///
/// where $T$ is time, $M$ is additional memory, and $n$ is `len`.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_fixed_length_unsigned_vecs;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::{ToBinaryString, ToDebugString};
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_fixed_length_unsigned_vecs::<u8>(EXAMPLE_SEED, 3, 10, 1)
/// .map(
/// |xs| prefix_to_string(
/// xs.into_iter().map(|x: u8| x.to_binary_string()),
/// 100
/// )
/// ),
/// 10,
/// ),
/// "[[0, 0, 111000], [0, 11111100, 11], [11111110, 1111, 0], [0, 0, 11111000], \
/// [0, 0, 1111110], [11111111, 11011111, 11111111], [11110000, 11111111, 11111111], \
/// [11000011, 11111, 0], [0, 10000000, 11111001], [11111111, 0, 0], ...]"
/// );
/// ```
/// Generates random striped [`Vec`]s of unsigneds.
///
/// See [here](self) for more information.
///
/// The lengths of the [`Vec`]s are sampled from a geometric distribution with a specified mean
/// $m$, equal to `mean_length_numerator / mean_length_denominator`. $m$ must be greater than 0.
///
/// The mean run length (before the bit sequences are truncated) is
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// $$
/// P((x_0, x_1, \ldots, x_{n-1})) = \frac{m^n}{(m+1)^{n+1}}\prod_{i=0}^{n-1}P(x_i).
/// $$
///
/// # Expected complexity per iteration
/// $T(n) = O(n)$
///
/// $M(n) = O(n)$
///
/// where $T$ is time, $M$ is additional memory, and $n$ is
/// `mean_length_numerator / mean_length_denominator`.
///
/// # Panics
/// Panics if `mean_stripe_denominator` is zero, if
/// `mean_stripe_numerator <= mean_stripe_denominator`, if `mean_length_numerator` or
/// `mean_length_denominator` are zero, or, if after being reduced to lowest terms, their sum is
/// greater than or equal to $2^{64}$.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_unsigned_vecs;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::{ToBinaryString, ToDebugString};
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_unsigned_vecs::<u8>(EXAMPLE_SEED, 10, 1, 2, 1)
/// .map(
/// |xs| prefix_to_string(
/// xs.into_iter().map(|x: u8| x.to_binary_string()),
/// 100
/// )
/// ),
/// 10,
/// ),
/// "[[0, 0, 111000, 0, 11111110, 10000001], [0], \
/// [11110000, 11111111, 11111111, 11111111, 11, 0, 10000000, 11111], [0], \
/// [10000, 0, 11111100, 11111111, 1111111, 11111000, 11, 0, 0, 10011000, 11111111, 111, 0, \
/// 0], [], [11111111, 11111111, 11111111, 11111111, 10111111], [0, 0, 0, 11110000], \
/// [11111111], [], ...]"
/// );
/// ```
/// Generates random striped [`Vec`]s of unsigneds, with a minimum length.
///
/// See [here](self) for more information.
///
/// The lengths of the [`Vec`]s are sampled from a geometric distribution with a specified mean
/// $m$, equal to `mean_length_numerator / mean_length_denominator`. $m$ must be greater than
/// `min_length`.
///
/// The mean run length (before the bit sequences are truncated) is
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// $$
/// P((x_0, x_1, \ldots, x_{n-1})) = \\begin{cases}
/// \frac{(m-a)^{n-a}}{(m+1-a)^{n+1-a}}\prod_{i=0}^{n-1}P(x_i) & n \geq a \\\\
/// 0 & \\text{otherwise},
/// \\end{cases}
/// $$
/// where $a$ is `min_length`.
///
/// # Expected complexity per iteration
/// $T(n) = O(n)$
///
/// $M(n) = O(n)$
///
/// where $T$ is time, $M$ is additional memory, and $n$ is
/// `mean_length_numerator / mean_length_denominator`.
///
/// # Panics
/// Panics if `mean_stripe_denominator` is zero, if
/// `mean_stripe_numerator <= mean_stripe_denominator`, if `mean_length_numerator` or
/// `mean_length_denominator` are zero, if their ratio is less than or equal to `min_length`, or if
/// they are too large and manipulating them leads to arithmetic overflow.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_unsigned_vecs_min_length;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_unsigned_vecs_min_length::<u8>(EXAMPLE_SEED, 2, 10, 1, 3, 1)
/// .map(
/// |xs| prefix_to_string(
/// xs.into_iter().map(|x: u8| x.to_binary_string()),
/// 100
/// )
/// ),
/// 10,
/// ),
/// "[[0, 0, 111000], [0, 11111100, 11, 11111111], \
/// [11110000, 11111111, 11111111, 11111111], [11111000, 11111111, 11111111, 11000000], \
/// [0, 10000, 0], [111, 0, 0, 1111], [11110000, 11111111], [11111111, 111111], \
/// [110, 10000000, 11111111], [11111111, 11111111], ...]"
/// );
/// ```
/// Generates random striped [`Vec`]s of unsigneds, with lengths in $[a, b)$.
///
/// See [here](self) for more information.
///
/// The lengths of the [`Vec`]s are sampled from a uniform distribution on $[a, b)$. $a$ must be
/// less than $b$.
///
/// The mean run length (before the bit sequences are truncated) is
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// $$
/// P((x_0, x_1, \ldots, x_{n-1})) = \\begin{cases}
/// \frac{1}{b-a}\prod_{i=0}^{n-1}P(x_i) & \text{if} \\quad a \leq n < b, \\\\
/// 0 & \\text{otherwise}.
/// \\end{cases}
/// $$
///
/// # Expected complexity per iteration
/// $T(n) = O(b)$
///
/// $M(n) = O(b)$
///
/// where $T$ is time and $M$ is additional memory.
///
/// # Panics
/// Panics if `mean_stripe_denominator` is zero, if
/// `mean_stripe_numerator <= mean_stripe_denominator`, or if $a \geq b$.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_unsigned_vecs_length_range;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_unsigned_vecs_length_range::<u8>(EXAMPLE_SEED, 2, 4, 10, 1)
/// .map(
/// |xs| prefix_to_string(
/// xs.into_iter().map(|x: u8| x.to_binary_string()),
/// 100
/// )
/// ),
/// 10,
/// ),
/// "[[0, 0, 111000], [0, 11111100], [11111000, 1, 11110000], [0, 0, 0], \
/// [11110000, 11111111], [11111111, 11, 11111111], [1000000, 0, 11110000], \
/// [11111111, 11111111], [1111000, 11000000, 11111111], [11111111, 11111111, 1100], ...]"
/// );
/// ```
/// Generates random striped [`Vec`]s of unsigneds, with lengths in $[a, b]$.
///
/// See [here](self) for more information.
///
/// The lengths of the [`Vec`]s are sampled from a uniform distribution on $[a, b]$. $a$ must be
/// less than $b$.
///
/// The mean run length (before the bit sequences are truncated) is
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// $$
/// P((x_0, x_1, \ldots, x_{n-1})) = \\begin{cases}
/// \frac{1}{b-a+1}\prod_{i=0}^{n-1}P(x_i) & \text{if} \\quad a \leq n \leq b, \\\\
/// 0 & \\text{otherwise}.
/// \\end{cases}
/// $$
///
/// # Expected complexity per iteration
/// $T(n) = O(b)$
///
/// $M(n) = O(b)$
///
/// where $T$ is time and $M$ is additional memory.
///
/// # Panics
/// Panics if `mean_stripe_denominator` is zero, if
/// `mean_stripe_numerator <= mean_stripe_denominator`, or if $a \geq b$.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_unsigned_vecs_length_inclusive_range;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_unsigned_vecs_length_inclusive_range::<u8>(EXAMPLE_SEED, 2, 3, 10, 1)
/// .map(
/// |xs| prefix_to_string(
/// xs.into_iter().map(|x: u8| x.to_binary_string()),
/// 100
/// )
/// ),
/// 10,
/// ),
/// "[[0, 0, 111000], [0, 11111100], [11111000, 1, 11110000], [0, 0, 0], \
/// [11110000, 11111111], [11111111, 11, 11111111], [1000000, 0, 11110000], \
/// [11111111, 11111111], [1111000, 11000000, 11111111], [11111111, 11111111, 1100], ...]"
/// );
/// ```
/// Generates random striped unsigneds from a range.
/// Generates random striped unsigneds in the range $[a, b)$.
///
/// See [here](self) for more information.
///
/// The unsigneds are generated using a striped bit sequence with mean run length
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// Because the unsigneds are constrained to be within a certain range, the actual mean run length
/// will usually not be $m$. Nonetheless, setting a higher $m$ will result in a higher mean run
/// length.
///
/// # Expected complexity per iteration
/// $T(n) = O(n)$
///
/// $M(n) = O(n)$
///
/// where $T$ is time, $M$ is additional memory, and $n$ is `b.significant_bits()`.
///
/// # Panics
/// Panics if `mean_stripe_denominator` is zero, if
/// `mean_stripe_numerator <= mean_stripe_denominator`, or if $a \geq b$.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_unsigned_range;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_unsigned_range::<u8>(EXAMPLE_SEED, 1, 7, 4, 1)
/// .map(|x| x.to_binary_string()),
/// 10
/// ),
/// "[1, 1, 1, 110, 1, 110, 10, 11, 11, 100, ...]"
/// );
/// ```
/// Generates random striped unsigneds in the range $[a, b]$.
///
/// See [here](self) for more information.
///
/// The unsigneds are generated using a striped bit sequence with mean run length
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// Because the unsigneds are constrained to be within a certain range, the actual mean run length
/// will usually not be $m$. Nonetheless, setting a higher $m$ will result in a higher mean run
/// length.
///
/// # Expected complexity per iteration
/// $T(n) = O(n)$
///
/// $M(n) = O(n)$
///
/// where $T$ is time, $M$ is additional memory, and $n$ is `b.significant_bits()`.
///
/// # Panics
/// Panics if `mean_stripe_denominator` is zero, if
/// `mean_stripe_numerator <= mean_stripe_denominator`, or if $a > b$.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_unsigned_inclusive_range;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_unsigned_inclusive_range::<u8>(EXAMPLE_SEED, 1, 6, 4, 1)
/// .map(|x| x.to_binary_string()),
/// 10
/// ),
/// "[1, 1, 1, 110, 1, 110, 10, 11, 11, 100, ...]"
/// );
/// ```
/// Generates random striped signeds from a range.
/// Generates random striped signeds in the range $[a, b]$.
///
/// See [here](self) for more information.
///
/// The unsigneds are generated using a striped bit sequence with mean run length
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// Because the signeds are constrained to be within a certain range, the actual mean run length
/// will usually not be $m$. Nonetheless, setting a higher $m$ will result in a higher mean run
/// length.
///
/// # Expected complexity per iteration
/// $T(n) = O(n)$
///
/// $M(n) = O(n)$
///
/// where $T$ is time, $M$ is additional memory, and $n$ is
/// `max(a.significant_bits(), b.significant_bits())`.
///
/// # Panics
/// Panics if `mean_stripe_denominator` is zero, if
/// `mean_stripe_numerator <= mean_stripe_denominator`, or if $a > b$.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_signed_inclusive_range;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_signed_inclusive_range::<u8, i8>(EXAMPLE_SEED, -5, 10, 4, 1)
/// .map(|x| x.to_binary_string()),
/// 10
/// ),
/// "[11111011, 11111100, 1000, 111, 11111111, 1000, 11, 1000, 0, 1000, ...]"
/// );
/// ```
/// Generates random striped signeds in the range $[a, b)$.
///
/// See [here](self) for more information.
///
/// The unsigneds are generated using a striped bit sequence with mean run length
/// $m$ = `mean_stripe_numerator / mean_stripe_denominator`.
///
/// Because the signeds are constrained to be within a certain range, the actual mean run length
/// will usually not be $m$. Nonetheless, setting a higher $m$ will result in a higher mean run
/// length.
///
/// # Expected complexity per iteration
/// $T(n) = O(n)$
///
/// $M(n) = O(n)$
///
/// where $T$ is time, $M$ is additional memory, and $n$ is
/// `max(a.significant_bits(), b.significant_bits())`.
///
/// # Panics
/// Panics if `mean_stripe_denominator` is zero, if
/// `mean_stripe_numerator <= mean_stripe_denominator`, or if $a \geq b$.
///
/// # Examples
/// ```
/// use malachite_base::iterators::prefix_to_string;
/// use malachite_base::num::random::striped::striped_random_signed_range;
/// use malachite_base::random::EXAMPLE_SEED;
/// use malachite_base::strings::ToBinaryString;
///
/// assert_eq!(
/// prefix_to_string(
/// striped_random_signed_range::<u8, i8>(EXAMPLE_SEED, -5, 11, 4, 1)
/// .map(|x| x.to_binary_string()),
/// 10
/// ),
/// "[11111011, 11111100, 1000, 111, 11111111, 1000, 11, 1000, 0, 1000, ...]"
/// );
/// ```