pub fn striped_random_signed_range<U: PrimitiveUnsigned + WrappingFrom<S>, S: PrimitiveSigned + WrappingFrom<U>>(
    seed: Seed,
    a: S,
    b: S,
    mean_stripe_numerator: u64,
    mean_stripe_denominator: u64
) -> StripedRandomSignedInclusiveRange<U, S>Notable traits for StripedRandomSignedInclusiveRange<U, S>impl<U: PrimitiveUnsigned, S: PrimitiveSigned + WrappingFrom<U>> Iterator for StripedRandomSignedInclusiveRange<U, S> type Item = S;
Expand description

Generates random striped signeds in the range $[a, b]$.

See here 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, ...]"
);