6 : m_random_engine(
std::random_device {}())
7 , m_current_start(-1.0F)
9 , m_normal_spread(4.0F)
35 std::vector<double> samples;
36 samples.reserve(num_samples);
38 for (
unsigned int i = 0; i < num_samples; ++i) {
63 std::exponential_distribution<double> dist(1.0);
71 throw std::invalid_argument(
"Invalid distribution type");
78 sample = std::max(start, std::min(end, sample));
81 sample = start + sample * (end - start);
89 throw std::invalid_argument(
"Start must be less than or equal to end");
96 return std::make_unique<StochasticContextGpu>(
double m_amplitude
Base amplitude of the generator.
Utils::distribution m_type
Current probability distribution algorithm.
void validate_range(double start, double end) const
Validates that the specified range is mathematically valid.
double m_normal_spread
Variance parameter for normal distribution.
std::vector< double > process_batch(unsigned int num_samples) override
Generates multiple stochastic values at once.
std::vector< double > random_array(double start, double end, unsigned int num_samples)
Generates an array of stochastic values within a specified range.
std::mt19937 m_random_engine
Mersenne Twister entropy generator.
double transform_sample(double sample, double start, double end) const
Transforms a raw value to fit within the specified range.
std::unique_ptr< NodeContext > create_context(double value) override
Creates a context object for callbacks.
void printGraph() override
Visualizes the distribution characteristics.
Random(Utils::distribution type=Utils::distribution::UNIFORM)
Constructor for the stochastic generator.
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.
double random_sample(double start, double end)
Generates a stochastic value within a specified range.
void printCurrent() override
Outputs the current configuration parameters.
void notify_tick(double value) override
Notifies all registered callbacks about a new value.
double process_sample(double input=0.) override
Generates a single stochastic value.
std::vector< NodeHook > m_callbacks
Collection of standard callback functions.
double m_last_output
The most recent sample value generated by this oscillator.
std::vector< std::pair< NodeHook, NodeCondition > > m_conditional_callbacks
Collection of conditional callback functions with their predicates.
bool m_gpu_compatible
Flag indicating if the node supports GPU processing This flag is set by derived classes to indicate w...
std::unique_ptr< NodeContext > m_last_context
The last context object created for callbacks.
std::span< const float > get_gpu_data_buffer() const
Provides access to the GPU data buffer.