pub trait FloatExt:
Float
+ ConstZero
+ ConstOne
+ FloatConst
+ AddAssign {
const HALF: Self;
const TWO: Self;
// Required methods
fn from_f64(x: f64) -> Self;
fn from_usize(n: usize) -> Self;
fn into_usize(self) -> usize;
fn u01x2(hash: u64) -> (ClosedOpenUnit<Self>, OpenClosedUnit<Self>);
}
Expand description
Floating point types.
Required Associated Constants§
Required Methods§
Sourcefn from_usize(n: usize) -> Self
fn from_usize(n: usize) -> Self
Converts from a usize
.
Sourcefn into_usize(self) -> usize
fn into_usize(self) -> usize
Converts into a usize
.
Sourcefn u01x2(hash: u64) -> (ClosedOpenUnit<Self>, OpenClosedUnit<Self>)
fn u01x2(hash: u64) -> (ClosedOpenUnit<Self>, OpenClosedUnit<Self>)
Generates two uniform random numbers from a random hash
value.
The first is sampled from [0.0, 1.0)
, the second from (0.0, 1.0]
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.