pub fn decimal_normal_sample() -> DecimalExpand description
Draws a standard normal sample from the thread-local RNG, as a Decimal.
This is the unseeded path: every call reads the thread RNG, so two runs
never see the same stream. Reproducible callers use
decimal_normal_sample_with with a seeded generator such as
crate::utils::deterministic_rng; this function is exactly that helper
applied to rand::rng().
§Returns
A Decimal sampled from a standard normal distribution (it can be
negative).
§Examples
use optionstratlib_core::model::decimal::decimal_normal_sample;
let normal = decimal_normal_sample();The sample is drawn from rand_distr::StandardNormal, which is a unit
struct with no constructor and therefore nothing to reject. It replaced
Normal::new(0.0, 1.0), whose Err arm had no value to return and so
aborted. The two are the same distribution and the same value: Normal
samples StandardNormal and applies mean + std_dev * z, which is the
identity at (0.0, 1.0).