Trait opendp::samplers::SampleGaussian [−][src]
pub trait SampleGaussian: Sized { fn sample_gaussian(
shift: Self,
scale: Self,
constant_time: bool
) -> Fallible<Self>; }
Required methods
fn sample_gaussian(
shift: Self,
scale: Self,
constant_time: bool
) -> Fallible<Self>
fn sample_gaussian(
shift: Self,
scale: Self,
constant_time: bool
) -> Fallible<Self>
Generates a draw from a Gaussian(loc, scale) distribution using the MPFR library.
If shift = 0 and scale = 1, sampling is done in a way that respects exact rounding. Otherwise, the return will be the result of a composition of two operations that respect exact rounding (though the result will not necessarily).
Arguments
shift
- The expectation of the Gaussian distribution.scale
- The scaling parameter (standard deviation) of the Gaussian distribution.constant_time
- Force underlying computations to run in constant time.
Return
Draw from Gaussian(loc, scale)
Example
use opendp::samplers::SampleGaussian; let gaussian = f64::sample_gaussian(0.0, 1.0, false);