pub fn random_finite_primitive_floats<T: PrimitiveFloat>(
    seed: Seed
) -> RandomPrimitiveFloatInclusiveRange<T>Notable traits for RandomPrimitiveFloatInclusiveRange<T>impl<T: PrimitiveFloat> Iterator for RandomPrimitiveFloatInclusiveRange<T> type Item = T;
Expand description

Generates finite primitive floats.

Every float within the range has an equal probability of being chosen. This does not mean that the distribution approximates a uniform distribution over the reals. For example, a float in $[1/4, 1/2)$ is as likely to be chosen as a float in $[1, 2)$, since these subranges contain an equal number of floats.

Positive zero and negative zero are both generated. NaN is not.

The output length is infinite.

Expected complexity per iteration

Constant time and additional memory.

Examples

use malachite_base::iterators::prefix_to_string;
use malachite_base::num::float::NiceFloat;
use malachite_base::num::random::random_finite_primitive_floats;
use malachite_base::random::EXAMPLE_SEED;

assert_eq!(
    prefix_to_string(random_finite_primitive_floats::<f32>(EXAMPLE_SEED).map(NiceFloat), 10),
    "[-2.3484663e-27, 2.287989e-18, -2.0729893e-12, 3.360012e28, -9.021723e-32, 3564911.2, \
    -0.0000133769445, -1.8855448e18, 8.2494555e-29, 2.2178014e-38, ...]"
);