pub struct UniformFloat<X> { /* fields omitted */ }
The back-end implementing UniformSampler
for floating-point types.
Unless you are implementing UniformSampler
for your own type, this type
should not be used directly, use Uniform
instead.
Instead of generating a float in the [0, 1)
range using Standard
, the
UniformFloat
implementation converts the output of an PRNG itself. This
way one or two steps can be optimized out.
The floats are first converted to a value in the [1, 2)
interval using a
transmute-based method, and then mapped to the expected range with a
multiply and addition. Values produced this way have what equals 22 bits of
random digits for an f32
, and 52 for an f64
.
Currently there is no difference between new
and new_inclusive
,
because the boundaries of a floats range are a bit of a fuzzy concept due to
rounding errors.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
The type sampled by this implementation.
[−]
Construct self, with inclusive lower bound and exclusive upper bound [low, high)
. Read more
Construct self, with inclusive bounds [low, high]
. Read more
Sample a single value uniformly from a range with inclusive lower bound and exclusive upper bound [low, high)
. Read more
The type sampled by this implementation.
[−]
Construct self, with inclusive lower bound and exclusive upper bound [low, high)
. Read more
Construct self, with inclusive bounds [low, high]
. Read more
Sample a single value uniformly from a range with inclusive lower bound and exclusive upper bound [low, high)
. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
[+]
[+]
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
[−]
🔬 This is a nightly-only experimental API. (try_from
)
[+]
[−]
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static