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

◆ random_array()

std::vector< double > MayaFlux::Nodes::Generator::Stochastics::Random::random_array ( double  start,
double  end,
unsigned int  num_samples 
)

Generates an array of stochastic values within a specified range.

Parameters
startLower bound of the range
endUpper bound of the range
num_samplesNumber of values to generate
Returns
Vector of values within the specified range

Generates a collection of values following the current distribution, mapped to the specified numerical range.

Definition at line 29 of file Stochastic.cpp.

30{
31 validate_range(start, end);
32 m_current_start = start;
33 m_current_end = end;
34
35 std::vector<double> samples;
36 samples.reserve(num_samples);
37
38 for (unsigned int i = 0; i < num_samples; ++i) {
39 samples.push_back(transform_sample(generate_distributed_sample(), start, end) * m_amplitude);
40 }
41
42 return samples;
43}
double m_amplitude
Base amplitude of the generator.
void validate_range(double start, double end) const
Validates that the specified range is mathematically valid.
double transform_sample(double sample, double start, double end) const
Transforms a raw value to fit within the specified range.
double m_current_start
Lower bound of the current output range.
double generate_distributed_sample()
Generates a raw value according to the current distribution.
double m_current_end
Upper bound of the current output range.

References generate_distributed_sample(), MayaFlux::Nodes::Generator::Generator::m_amplitude, m_current_end, m_current_start, transform_sample(), and validate_range().

Referenced by process_batch().

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