f64

Function f64 

Source
pub fn f64() -> f64
Expand description

Generate a random f64, such that special or problematic values are much more common than normal.

The distribution is not statistically useful, but it ensures that all edge-case values get a fair chance of being generated. This is better than using a regular random number generator, because in the vast majority of cases, a random number generator will generate perfectly regular and well-behaved values, and certain values, like INFINITY and NAN may be impossible to generate.

The distribution is as follows:

  • 25% normal values
  • 25% subnormal values
  • 25% NAN values, including all possible payloads, quiet and signaling NAN.
  • 25% “special” values, i.e. unique values with special properties such as INFINITY and -0.0