MayaFlux 0.2.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 42 of file Stochastic.cpp.

43{
44 validate_range(start, end);
45 m_current_start = start;
46 m_current_end = end;
47
48 std::vector<double> samples;
49 samples.reserve(num_samples);
50
51 for (unsigned int i = 0; i < num_samples; ++i) {
52 samples.push_back(transform_sample(generate_distributed_sample(), start, end) * m_amplitude);
53 }
54
55 return samples;
56}
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: