There are several ways people come up with "random" numbers. I say "random" because they are just a sequence of numbers started off with a seed number. Having the same seed will generate the same list of "random" numbers. Look on the web for Number Theroy and Random. It should turn up a few results.
The only way I can remeber off the top of my head is a squaring trick. Basicly, you give me a number, and I square it. The two middle digits are now the new number to square. This creates a "random" sequence, except in a few cases which will lead you to squaring the same number over and over.
JigPu