Seven BASIC programs are presented that use algorithms for selection of treatments and samples in spatial and temporal contexts. Program (1) takes a natural sequence of samples (such as logs cut from a tree trunk) and divides them into groups (equal to the number of samples divided by treatments), and then selects non-redundantly from each group a sample at random for each treatment. Program (2) matches items from different categories equally to any number of treatments in proportion to the numbers of items of each category. Program (3) selects sampling times or segment lengths of specified interval and number from within a time period or perimeter distance. These samples can be spaced apart by at least a specified amount of time or distance but otherwise are chosen at random. In program (4), a series of sample coordinates (x,y) are chosen at random from a rectangular area so that no points are closer than a specified minimum distance to any other. For each of the sample points, the Cartesian and polar coordinates are given. Program (5) generates any possible Latin square, while program (6) generates Latin cubes, and program (7) makes Graeco-Latin cubes. Examples of program use and output are presented for experiments with bark beetles (Coleoptera: Scolytidae) responding to pheromone blends and colonizing host trees.