MayaFlux 0.1.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 50 of file Stochastic.cpp.

51{
52 switch (m_type) {
54 std::uniform_real_distribution<double> dist(m_current_start, m_current_end);
55 return dist(m_random_engine);
56 }
58 const double range = m_current_end - m_current_start;
59 std::normal_distribution<double> dist(0.0, range / m_normal_spread);
60 return dist(m_random_engine);
61 }
63 std::exponential_distribution<double> dist(1.0);
64 return dist(m_random_engine);
65 }
67 std::poisson_distribution<int> dist(m_current_end - m_current_start);
68 return static_cast<double>(dist(m_random_engine));
69 }
70 default:
71 throw std::invalid_argument("Invalid distribution type");
72 }
73}
Utils::distribution m_type
Current probability distribution algorithm.
double m_normal_spread
Variance parameter for normal distribution.
std::mt19937 m_random_engine
Mersenne Twister entropy generator.
double m_current_start
Lower bound of the current output range.
double m_current_end
Upper bound of the current output range.

References MayaFlux::Utils::EXPONENTIAL, m_current_end, m_current_start, m_normal_spread, m_random_engine, m_type, MayaFlux::Utils::NORMAL, MayaFlux::Utils::POISSON, and MayaFlux::Utils::UNIFORM.

Referenced by random_array(), and random_sample().

+ Here is the caller graph for this function: