pub fn random_nonzero_signeds<T: PrimitiveSigned>(
    seed: Seed
) -> NonzeroValues<RandomPrimitiveInts<T>>
Expand description

Uniformly generates random nonzero signed integers.

$$ P(x) = \begin{cases} \frac{1}{2^W-1} & \text{if} \quad x \neq 0, \\ 0 & \text{otherwise}, \end{cases} $$ where $W$ is the width of the type.

The output length is infinite.

Complexity per iteration

Constant time and additional memory.

Examples

use malachite_base::iterators::prefix_to_string;
use malachite_base::num::random::random_nonzero_signeds;
use malachite_base::random::EXAMPLE_SEED;

assert_eq!(
    prefix_to_string(random_nonzero_signeds::<i8>(EXAMPLE_SEED), 10),
    "[113, -17, 69, 108, -28, -46, -88, -95, 87, 32, ...]"
)