# Testing and getting nowhere

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.

1. Generate a random number uniformly between 0 and 1
2. Subtract 0.5
3. Multiply by π
4. Take the tangent
6. Print the result
7. 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.

## 2 thoughts on “Testing and getting nowhere”

1. EastwoodDC

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.

2. John Venier

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