MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ generate_distributed_sample()

double MayaFlux::Nodes::Generator::Stochastics::Random::generate_distributed_sample ( )
private

Generates a raw value according to the current distribution.

Returns
Raw stochastic value before range transformation

This internal method applies the selected probability algorithm to generate a value with the appropriate statistical properties.

Definition at line 63 of file Stochastic.cpp.

64{
65 switch (m_type) {
66 [[likely]] case Utils::distribution::UNIFORM:
68
72
76
78 std::poisson_distribution<int> dist(
79 static_cast<int>(m_current_end - m_current_start));
80 return static_cast<double>(dist(m_random_engine));
81 }
82 default:
84 }
85}
Utils::distribution m_type
Current probability distribution algorithm.
std::exponential_distribution< double > m_exponential_dist
Exponential distribution with lambda = 1.
std::normal_distribution< double > m_normal_dist
Normal distribution with mean 0 and standard deviation 1.
std::mt19937 m_random_engine
Mersenne Twister entropy generator.
double m_current_start
Lower bound of the current output range.
double fast_uniform() noexcept
Fast uniform random number generator using xorshift algorithm.
double m_current_end
Upper bound of the current output range.
void rebuild_distributions_if_needed() noexcept
Rebuilds distribution objects if parameters have changed.

References MayaFlux::Utils::EXPONENTIAL, fast_uniform(), m_current_end, m_current_start, m_exponential_dist, m_normal_dist, m_random_engine, m_type, MayaFlux::Utils::NORMAL, MayaFlux::Utils::POISSON, rebuild_distributions_if_needed(), and MayaFlux::Utils::UNIFORM.

Referenced by random_array(), and random_sample().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: