# How to use random number tables and generators

In simple random sampling, every potential sampling unit (individual or quadrat) has an equal chance of getting selected and the selection of one sampling unit does not affect the chance of selecting another. Equal probability (the "simple" part of simple random sampling) and independence are met by sampling from a uniform statistical distribution. This is lucky because that is what random number tables and random number generators on calculators use.

Random number generation is important in nearly every study in vegetation science. If you have never used random number generation, or are a bit rusty, go through this section carefully. You will be applying the techniques you learn here in your class projects.

Some of the examples might make sense only after reading the section of the course on Simple Random Sampling. In fact, simple random sampling and random number selection are so intertwined that you might have to go back and forth between the two sections.

## How to use a typical random number generator in a calculator

Calculators with the capability to generate random numbers nearly always give a random uniform number between 0 and 1. To use these numbers, you need to convert them to a range that matches your study.

### An example of selecting individuals at random

Consider an example of sampling by individuals. Imagine you have completed the design phase of your field study. You now want to take measurements from a subset of six canopy trees out of the 24 in your statistical population. You have already numbered the trees from 1 to 24.

The calculator gives you a random real number between 0 and 1. To convert this number to a random integer between 1 and 24, multiply the calculator number by 24 and round up to the next integer. (Here is a technicality: skip if the calculator gives 0.0000 exactly.) For example, if the calculator gives 0.5481, multiply 0.5481 by 24 to get 13.15. Round up to 14. This answer means that tree number 14 is in your sample.

## A simple way to use a random number table

A random number table is a series of digits (0 to 9) arranged randomly through the rows and columns. If you don't have access to a random number table, you can use one I generated for this class. Click here to see the table or to print it. (You must have Acrobat Reader to read this file.)

Pick an arbitrary starting point (using darts, poking the table with your eyes closed, whatever; every part of the table is random, you just need to avoid starting at the same spot every time). Read down the columns from the arbitrary starting point, accepting any integers in your range.

### The same example of selecting individuals at random

In the tree example from the section on Simple Random Sampling, the range is 01 to 24, corresponding to trees number 1 to 24. If the number from the table is outside the range, skip it and try the next one. Let's say that your arbitrary starting point is row 11 and column 2 on the course random number table. Looking at columns 2 and 3, the first entry is "10." So tree number 10 is in the sample. The next entry is "02,"so tree number 2 is in the sample. But the next number is "86," which is outside the range of 1 to 24, so you skip it.

## Three examples of selecting random locations

Consider another example, choosing random quadrat locations by the coordinate system. Imagine you have completed the design phase of your field study and you want to take measurements from eight 1-m2 quadrats within a 12-m by 15-m study area.

 First get the 12-m coordinate. Use the calculator to get a random number between 0 and 1. Multiply this number by 12 to get the position of the quadrat along this axis. Get another random number for the 15-m coordinate, and multiply it by 15 to get the position of the quadrat along this axis. For example, the calculator gives you 0.3280, which you multiply by 12 to get 3.94. The second number from the calculator is 0.7002, which you multiply by 15 to get 10.50. This means that the quadrat located at coordinate position 3.94 m and 10.50 m is part of your sample set.  Repeat these steps for the remaining seven quadrats. It is important to use a lot of digits in your random number, for example, 0.3280 vs. 0.3.  If you just used 0.3, then your locations could be no closer than 1.2 m apart!  Do you see why?  0.3 times 12 gives 3.6 m and 0.4 times 12 gives 4.8 m.  If you were using a 0.5-m by 0.5-m quadrat, then more then most of your study are could never be selected for sampling.  This is no good!.

Now consider a second case, locating quadrats with the coordinate system. You first need to decide how carefully you want to locate your sample (like every meter, every 10 cm, or every cm). Sometimes a resolution of 1 m is adequate, but tapes are usually marked in centimeters, so keeping a resolution of 0.01 m provides a more satisfactory randomization with no extra work either before hand or in the field. For locating a quadrat along an axis of 12 m, you would look at two columns, for numbers from 00 to 12. If you want a resolution of 0.01 m, you would look at four columns (for a range of 0000 to 1200), and put a decimal point between the third and fourth digit. For example, an entry in the random number table of "0542" means that the coordinate is 5.42 m. If the next entry is outside the range (like "6780"), skip it and try another one.

The third example is using the grid system with the random number generator on a calculator. Imagine you have completed the design phase of your field study. You want to take measurements within eight 1-m 2 quadrats within a 12-m by 15-m study area. In this case, there are 180 possible 1-m 2 sections within the study area. So the process of random selection is simply picking integers from 1 to 180. To do this, multiply the random number (which is between 0 and 1) by 180 and round up to the next integer.

## A technicality

In this class, and in most of vegetation science, sampling is done without replacement. That is, once selected, a data point (tree, quadrat location, whatever) is removed from further chance of being selected. If the procedures described here generate the same data point (tree, quadrat location, whatever), just skip that random number and try another one.

If you can't wait to jump all over these methods of using random numbers, go to Assignments in Blackboard and select the quiz called "Using random numbers." Otherwise you can wait until the end of the Simple random sampling in the field chapter.

© 2007 Mark V. Wilson and Oregon State University