 StatTools : Random Number Explained
 Related Links: Introduction Examples References Random numbers are widely used to model random events, but truly random numbers are difficult to obtained, requiring random events observed in nature, such as the time interval between radio statics or lightning strikes. For most purposes in medical research, that level of randomness is unnecessary, and computer generated pseudorandom numbers are used. Types of random numbers The program in Random Numbers Generation Program Page generates 4 types of random numbers in common use. Random real numbers are real numbers, evenly distributed, with values between 0 and 1. Random normally distributed numbers are real numbers with a normal distribution, it's mean and Standard Deviation nominated by the user Random integers are whole numbers, within a range defined by the user. Random integers in blocks are blocks of integer numbers. The range within each block is defined by the user, but the order of the numbers are randomized. How random numbers are generated Pseudorandom numbers are generated by computer programs. The program ensures that the numbers generated do not form any pattern, that the value of each number is not dependent or influenced by the numbers already generated, and that the sequence of numbers is not repeated during use. StatTools uses the Ran3 algorithm described in the Numerical Recipes (see reference). This algorithm has a long non-recurring cycle, and when provided with the same seed will generate the same sequence of random numbers. Use of random numbers Random real numbers, and random normally distributed numbers are often used to model numerical systems that depends on random occurrences. Examples of these are weather and climate models, economic models, movement of share prices, and so on. Most examples of data presented by StatTools are generated by random numbers. Random integers and integers in blocks are used more frequently in medical research, and these will be discussed in greater details in the examples section. Balanced random numbers Standard random number sequences requires that the value of each number generated is independent of all the numbers previously generated. In random integers within a specified range, this means that all the numbers within the range have an equally chance of appearing on each occasion. This model represents true randomness, and resembles picking a numbered marble out of a barrel, and replacing it before taking another pick. Although the standard model provides true randomness, an even distribution of all possible numbers only occurs in a very large sequence, and in the usual volume of subjects in an average medical research project, where 50-100 subjects are used, the sample size between the groups may be different, and becomes a source of bias. There are also some research models, such as complex analysis of variance, where the mathematics is based on an assumption of equal sample size in all groups and subgroups, so discrepancies in group size may become problematic. An alternative is to provide random numbers that have balanced allocations, so that all numbers within the range are equally represented in the final sequence. This type of random number is usually generated by using an array of numbers, containing one number each within the range, and use the random number generator to create a random order within that array. This model resembles picking a numbered marble out of a barrel, but not replacing it before picking another. The advantage of the balanced model is the assurance that sample size in groups and subgroups are the same (balanced), and this reduces possible bias and error caused by group size discrepancies. However, by the very nature of being balanced, that each group will in the end be the same size means that, once a number is allocated, it will be less likely to be allocated again until the other possible numbers are allocated to the same frequency. True randomness is therefore lost. In the practical situation, with a reasonably large sample size, the minor loss of randomness, particularly if this loss is blinded to researchers and subjects, will cause very little bias, and may be preferred, particularly in situations where balanced group and subgroup size are essential to complex statistical analysis. 