Suppose a Martian gives you a black box. It has a button on top and a display on the side. Every time you press the button, the box displays a number. You want to figure out the pattern to the numbers, so you make a record of the outputs and keep a running average. You hit the button 100 times, but the average keeps moving around. So you decide to keep going until you’ve hit the button 1000 times. The average still doesn’t seem to be settling on a particular value.

What kind of devilish box has the Martian given you? It’s a Cauchy random number generator. Here’s how you could make your own.

- Generate a random number uniformly between 0 and 1
- Subtract 0.5
- Multiply by π
- Take the tangent
- Add a constant
- Print the result
- Go back to 1

If you ever suspect that you’re in possession of a black box with a Cauchy random number generator inside, keep a running *median* of your samples rather than a running *average*. The running average will never converge.

See Cauchy distribution parameter estimation for more graphs and more explanation.

Someone once came to ask me about the problems they were having with their stats. It turns out they were essentially taking the ratio of two normals. I had to explain that this was a bad idea.

Or you could get Cauchys by just taking the quotient of two independant standard normal random numbers.