Function smartnoise_runtime::utilities::noise::sample_gaussian [−][src]
pub fn sample_gaussian(
shift: f64,
scale: f64,
_enforce_constant_time: bool
) -> Result<f64>
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.
Return
Draw from Gaussian(loc, scale)
Example
use smartnoise_runtime::utilities::noise::sample_gaussian; let gaussian = sample_gaussian(0.0, 1.0, false);