pub trait TryRandomSampleFrom: Sized {
type Sample: RawRealTrait;
type Error: Error;
// Required method
fn try_sample_from<D, R>(
distribution: &D,
rng: &mut R,
precision_out: u32,
) -> Result<Self, Self::Error>
where D: Distribution<Self::Sample>,
R: Rng + ?Sized;
}Expand description
A fallible conversion from a distribution sample into Self at a requested precision.
precision_out is interpreted by the target type. Fixed-precision targets such as
f32 and f64 require their respective mantissa widths (24 and 53), while
rug::Float uses it as the precision of the constructed value.
Required Associated Types§
type Sample: RawRealTrait
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl TryRandomSampleFrom for Float
Available on crate feature rug only.
impl TryRandomSampleFrom for Float
Available on crate feature
rug only.