The same thing happens if you average random numbers, but there’s a nice side effect of getting values in the same range. That is to say: if you roll N 6 sided dice and average them, you will still get values between 1 and 6, but the more dice there are, the more the distribution will approach Gaussian. It shapes up pretty quickly too. Here is the histogram:

Something interesting to note is that adding two uniform random numbers together – or averaging them – makes something called “triangle distributed noise”. Looking at the histogram for averaging two values, hopefully you can see why it’s called triangle distributed! Triangle noise some cool properties for noise in graphics and is orthogonal to eg white noise vs blue noise vs low discrepancy sequences.

You can read about it in “Banding in Games”:

I recently saw some code that was taking the maximum of two random numbers and that made me wonder what sort of distribution that might give.

Being a better programmer than a mathematician, i made a histogram, then took a guess as to what the formula behind the shape might be.

It turns out that taking the max of N uniform random numbers is the same as using y=x^(N-1) as a PDF. (You of course would need to normalize it to be a real PDF)

If we take the min rather than the max, what happens then? Well, if for example the numbers are between 0 and 1, taking the min will give you the same count as if you took the max of 1-x. So, the graph of the histogram should look the same, just flipped on the x axis.

It turns out that it does:

Twitter Threads

Hey math friends. So if you add N random dice rolls together, it approaches the normal distribution as N approaches infinity. Is there a name for the distribution that comes up if you take the max of N rolls? At infinity i guess it'd be a dirac delta at max value but before then? pic.twitter.com/PrkoQdhZGm

New short blog post: What if you take two random numbers and take the max of em? "Taking the Max of Uniform Random Numbers"https://t.co/270ARxdHJm Spoiler: you get beta distributions pic.twitter.com/HbZLBTDuph

Pingback: Dice, Distributions & Noise Colors « The blog at the bottom of the sea