Flavors of static: random distributions and noise

It’s day one of noise generation in our flagship product! There are many ways to generate visual noise; our first algorithm is a simple static pixel generator. For these examples I’m generating a random integer from 0 to 255 and using that value to calculate a color on the gradient between two colors (here, blue and orange). Here’s the initial output:

It’s easiest to compare other output zoomed in a bit – here’s a section zoomed at 1200%:

I’m interested in tweaking the actual noise generation, which here means changing the random value generation (not just applying visual adjustments to the output). Filtering the random unit through a log() function creates a curve that produces more values closer to the maximum and few values closer to the minimum – which interpreted as color, means we see more orange:

The complementary approach uses an exponential function to produce a distribution that increases more slowly at first – mapping more values to the lower end of the scale, here meaning more blue:

These two approaches can be composed into two other useful flavors of output. If we map the log curve to the lower half of our random value output range, and an exponential curve to the upper half, we can get output that tends to favor values in the middle – a normal distribution that favors the blended colors over the extremes:

If we reverse this – mapping the exponential function to the lower half of the output, and the log function to the upper half – we get parabolic output, with fewer values in the middle of the range and more extreme blues and oranges:

The difference between the normalized, linear, and parabolic flavors are especially evident side-by-side. At screen resolution the normalized image appears softer, while the parabolic image looks sharper or grainer:

These modes of random-unit-value mapping are implemented in a core calculation module used by the noise data generator, as well as in a color-gradient class. The latter will also be used in fractal rendering to permit tweaking – look for examples tomorrow, which is Fractal Friday!