pub enum AdvancedAmountSampler {
LogNormal(LogNormalMixtureSampler),
Gaussian(GaussianMixtureSampler),
Pareto(ParetoSampler),
}Expand description
Advanced amount sampler wrapping one of the supported distribution
families. Callers keep their existing legacy AmountSampler(super::
AmountSampler) and only consult this wrapper when
distributions.amounts.enabled (or another advanced sub-block like
distributions.pareto.enabled) is true.
v3.4.4 added the Pareto variant for heavy-tailed monetary samples
(capex, strategic contracts, fraud amounts).
Variants§
LogNormal(LogNormalMixtureSampler)
Log-normal mixture (preferred for positive monetary amounts).
Gaussian(GaussianMixtureSampler)
Gaussian mixture (useful for signed quantities like deltas).
Pareto(ParetoSampler)
Pareto heavy-tailed distribution (v3.4.4+).
Implementations§
Source§impl AdvancedAmountSampler
impl AdvancedAmountSampler
Sourcepub fn new_log_normal(
seed: u64,
config: LogNormalMixtureConfig,
) -> Result<Self, String>
pub fn new_log_normal( seed: u64, config: LogNormalMixtureConfig, ) -> Result<Self, String>
Create a log-normal-mixture sampler.
Sourcepub fn new_gaussian(
seed: u64,
config: GaussianMixtureConfig,
) -> Result<Self, String>
pub fn new_gaussian( seed: u64, config: GaussianMixtureConfig, ) -> Result<Self, String>
Create a Gaussian-mixture sampler.
Sourcepub fn new_pareto(seed: u64, config: ParetoConfig) -> Result<Self, String>
pub fn new_pareto(seed: u64, config: ParetoConfig) -> Result<Self, String>
Create a Pareto sampler (v3.4.4+).
Sourcepub fn sample_decimal(&mut self) -> Decimal
pub fn sample_decimal(&mut self) -> Decimal
Sample one amount as Decimal.
Sourcepub fn ppf_decimal(&self, u: f64) -> Decimal
pub fn ppf_decimal(&self, u: f64) -> Decimal
v4.1.6+ inverse CDF (quantile function) — returns the Decimal
quantile at uniform u ∈ (0, 1) for whichever underlying
sampler is active. Gaussian variant clamps negatives to zero
(monetary-amount semantics).
Trait Implementations§
Source§impl Clone for AdvancedAmountSampler
impl Clone for AdvancedAmountSampler
Source§fn clone(&self) -> AdvancedAmountSampler
fn clone(&self) -> AdvancedAmountSampler
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AdvancedAmountSampler
impl RefUnwindSafe for AdvancedAmountSampler
impl Send for AdvancedAmountSampler
impl Sync for AdvancedAmountSampler
impl Unpin for AdvancedAmountSampler
impl UnsafeUnpin for AdvancedAmountSampler
impl UnwindSafe for AdvancedAmountSampler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.