The need for random number generator occurs quite often. And we are not talking about the built-in functions such as Random (). We are talking about their own generator or an algorithm of such a generator. Only at first glance it is a trivial problem. Try to write yourself a generator and you will see that it is not easy. You are offered two programs (Pascal), generating random numbers, and special features are not used. The text of the program is very easy to understand and rewrite them in any programming language. The basis of the algorithm has recurrently expression, the treatment to which the parameters obtained in the previous step, and allows you to generate the next random number. The coefficients are chosen for two cycles - a length of 64, the other - 65536. Generated by integers of the range. The main advantage of the algorithm that kazhnyj random number range is generated exactly once. Try to find a built-in function. It is easy to rewrite the algorithms so that the numbers are not integers, and range for example from 0 to 1. In one of the programs is illustrated, but by comparing the program easily return to integers. The program is very short, work fast, differ only in a set of coefficients and variable types. The program algorithm can be adapted to other intervals for integers, but will have to tinker (requires knowledge of mathematics).
You get a file in * .doc, which serves as the text of the two programs (the program - 12 lines with operators O and call).