﻿ Random Number Program

Graziano & Raulin
Research Methods (8th edition)

## Random Number Generator Program

### Graziano and Raulin

For your convenience, we have written a random number generator program, which you can download from this site. The program was written in Turbo Pascal by Windy Weaver and Mike Raulin and compiled to an EXE file. You can download the file by clicking on the filename below. This program is available for use by anyone who is using, or has used, the Graziano and Raulin Research Methods textbook.

## Operational Instructions

The random number generating program, RANDNUM.EXE, is simple to run and is menu driven. To run the program in Windows, simply double-click on the filename RANDNUM.EXE from the file manager or Windows Explorer. The program will print the output to the screen, but will also write the output to a text file (RAND-OUT.TXT). The output file can be printed for later reference using Notepad or any word processing program. Please note that each time the program is run it will overwrite the output file, so if you want to keep a copy, either print the output file or rename it before running the program again.

### Options

The random number program has four options that are accessed through two levels of menus. Each of the options are listed below, along with the menu choices to activate the choice.

#### Simple List of Random Numbers

This option will give you a list of random numbers with no constraints on the numbers. The program will ask you for the highest number desired, the lowest number desired, and how many random numbers you want. This option will effectively produce a random number table such as the one that appears in Appendix F of the text. In fact, this program did create the random number table that appears in the text.

To access this option, select choice 1 from the first menu and choice 1 from the second menu.

#### List of Random Numbers with No Repeated Numbers

This option will give you a list of random numbers with no duplicate numbers. The program will ask you for the highest number desired, the lowest number desired, and how many random numbers you want. Because this option does not repeat any of the random integers, the range (highest minus lowest score) must be at least as large as the number of random integers requested.

This option is especially useful for random sampling from a population, where each population member is given a unique sequential number. For example, if you want to sample 50 subjects from a population of 4000, number each subject in the population from 1 to 4000 and then request that the program give you 50 random numbers between 1 and 4000.

To access this option, select choice 1 from the first menu and choice 2 from the second menu.

#### Free Random Assignment to Groups

This option will produce a list of random numbers for random assignment to groups. There are no restrictions on the random numbers, so it is likely that the groups will not have the same sample size. The program will ask you for the number of groups and the number of subjects that you want to assign.

To access this option, select choice 2 from the first menu and choice 1 from the second menu.

#### Random Assignment within Blocks to Groups

This option will produce a list of random numbers for random assignment to groups, where the groups are randomized within blocks. For example, if you have four groups and 60 subjects to assign, the first four random numbers will be 1 through 4 in a random order, followed by another random order of 1 through 4, and so on.

Randomizing within blocks assures that the number of subjects will be equal or close to equal in the groups. It is also useful for matched random assignment or for generating random ordering of conditions for within-subjects designs.

When using the program for random ordering of conditions, you should tell the program that the number of subjects is equal to the actual number of subjects times the number of conditions. For example, if you have 30 subjects and 4 conditions, tell the program that you have 120 subjects (30 x 4) and 4 conditions. The program will then produce 30 blocks of 4 conditions, each block representing a random order of conditions. [Note that the program will print out full blocks of assignments. For example, if you request the assignment of 22 subjects to 4 condition, the program will print out 24 assignment (6 blocks of 4).] To access this option, select choice 2 from the first menu and choice 2 from the second menu.

### Printing the Output File

The easiest way to get a copy of the list of random numbers is to open the file RAND-OUT.txt using either Notepad or your word processing program, and then print the file from the program. The file will be written to the subdirectory from which the RANDNUM.EXE program was run. The output is formatted to print on standard size paper. If you want to save the output file, we recommend that you save it under another name so that you do not accidentally overwrite it when you run the RANDNUM.EXE program again.

### Tutorials on Using the Random Number Generator Program

We have included two detailed tutorial units on the CD, each of which shows how to use the random number generator program. One tutorial shows how to use the program to assign participants to groups or conditions. The second shows how to sample participants from a population.