There's no random number generator on a HP-12c, so if I wanted to a pocket dice-roller, I had to code up one of these formulas.
The basic idea is that you feed it a number and it spits out a number that you wouldn't expect, in a particular range, where it is somewhat uniformly distributed.