Normal Distribution (Bell Curve)

18%20AM

Normal Distribution

A question the other day by @espiegel123 on how to create a set of random values clustered around a mean led to this implementation of the Box-Muller algorithm. It generates a normal distribution (bell curve).


I/O

Input Signal Range Notes
clk 0-1 gate clock signal - unit produces a new value for each clock
mean any number mean value
std_dev any positive number standard deviation

Output Signal Range Notes
normally distributed random value depends on mean and standard deviation note that there is some truncation of tails due to 32 bit calculations


Version History

Revision File Date Notes
1.0 Box-Muller Normal Distribution V1.0.audulus (18.5 KB) 02/25/2019 initial upload
2 Likes

Thanks for this! What does standard deviation mean in this context though?

The standard deviation is a term from statistics that describes the width of the probability curve, or how widely distributed the random values are. A small standard deviation means the values are tightly clustered around the mean and a large one means the values are widely scattered. For a normal distribution, 68% of the values fall within 1 standard deviation, 95% fall within 2 standard deviations and 99.7 fall within 3 standard deviations. This is commonly referred to as the 68–95–99.7 rule. For other distributions the values will be different. With a standard deviation of 0.33 and a mean of 0, 99.7% of the values will fall between -1 and 1. With a mean of 0.5 and a standard deviation of 0.166, you will get 99.7% of the values between 0 and 1 with the curve centered on 0.5.

1 Like

Awesome, so it’s almost like bandwidth of a BPF - great module to add to the utility collection!

1 Like

It’s basically the same idea as bandwidth. Like a filter, a normal distribution doesn’t ever completely go to zero. In the ideal case the possible output values actually go from -infinity to +infinity, but because we are using 32 bit math the width of the distribution is actually limited to 6.66 standard deviations from the mean. If you want to prevent the 0.3% of outliers > 3 standard deviations, you can always use a clamp() to truncate the tails early.

Yeah, the sqrt() expression is going to make the distribution asymptotic in either direction. But we can use this to remake the stored/quantized random voltages of the 266e Buchla Module?

I’m not sure exactly how the stored random voltages work in the Buchla unit. I’m debugging a counter for Mark at the moment, but I’ll check out the docs when I get a chance. The QRST module I posted has similar controls to the Buchla stored randoms. The QRST uses a biased random walk instead of a normal distribution so the value of the next step is influenced by the current step instead of being independent.

1 Like