Randomness

From Maze

(Difference between revisions)
Jump to: navigation, search
(→The C64 and the RND Function: overview paragraph)
(→The C64 and the RND Function: added aesthetics paragraph)
Line 119:Line 119:
The way that 10 PRINT makes use of randomness on the C64 is of interest for a few reasons which will each be explored in turn. First, it is aesthetically necessary in order to achieve the desired effect. Second, the methods used in C64 BASIC are historically quite typical of computational approaches to pseudo-randomness since the 1950s. Third, out of several common approaches to randomness available on the C64, 10 PRINT uses a method well suited to experimentation, debugging, and the production of canonical results. Finally, in considering the approaches *not* employed, the C64 platform offered an unusually broad possibility space for exploring computational randomness, notably making available a second random "Noise" generator in the form of a unique sound chip.
The way that 10 PRINT makes use of randomness on the C64 is of interest for a few reasons which will each be explored in turn. First, it is aesthetically necessary in order to achieve the desired effect. Second, the methods used in C64 BASIC are historically quite typical of computational approaches to pseudo-randomness since the 1950s. Third, out of several common approaches to randomness available on the C64, 10 PRINT uses a method well suited to experimentation, debugging, and the production of canonical results. Finally, in considering the approaches *not* employed, the C64 platform offered an unusually broad possibility space for exploring computational randomness, notably making available a second random "Noise" generator in the form of a unique sound chip.
 +
As briefly glossed in the introduction, 10 PRINT prints a texture of diagonal lines that unpredictably alternate between left and right. This unpredictability in the emerging design is crucial to producing the impression of a maze. Indeed, if we consider variations of 10 PRINT with regular or no alternation, we can see what a big difference a little randomness makes.
 +
 +
[Small Images:]
 +
[1--10 PRINT with one character]
 +
[2--10 PRINT with strict alternation]
 +
 +
-----
 +
 +
This aesthetic issue extends to both the appearance of the final output and the code. While it was possible to implement one's own pseudo-random number generator in a BASIC problem, doing so would have lengthened and complicated 10 PRINT considerably from the concise and elegant one-liner program that circulated in C64 and PET magazines.
 +
Ever since the 1950s, a function to generate a random number has been built into most computer systems. The earliest version of BASIC included such a function, the familiar RND command. As the manual for the first Dartmouth version of BASIC describes the function, RND(X) produced a "new and different random number" between 0 and 1 "each time it is used in a program" (39). As noted by the manual, however, each time a program was run, "the same sequence" of random numbers is generated. If a BASIC program generated a string of random digits such as 9, 0, 4, 1, 6, 4, it would produce the exact same numbers the next time the program ran. This lack of variation is an extreme example of what mathematicians call "pseudo-randomness"--a process or algorithm that appears to be random, but which, if left running long enough, will reveal itself to be a pattern. While the "pseudo" prefix would seem to denigrate this type of randomness as "not really" random, pseudo-randomness is generally acceptable, and in fact, desirable in many situations. For example, engineers running a computer simulation often need random variables, but they need those random variables ''to be the same'' with every run of the simulation; otherwise it is impossible to narrow down what process is actually being modeled in the simulation. Pseudo-random number generators are the only kind that are useful in hashing, since they allow data to be distributed widely but also placed in known locations.
Ever since the 1950s, a function to generate a random number has been built into most computer systems. The earliest version of BASIC included such a function, the familiar RND command. As the manual for the first Dartmouth version of BASIC describes the function, RND(X) produced a "new and different random number" between 0 and 1 "each time it is used in a program" (39). As noted by the manual, however, each time a program was run, "the same sequence" of random numbers is generated. If a BASIC program generated a string of random digits such as 9, 0, 4, 1, 6, 4, it would produce the exact same numbers the next time the program ran. This lack of variation is an extreme example of what mathematicians call "pseudo-randomness"--a process or algorithm that appears to be random, but which, if left running long enough, will reveal itself to be a pattern. While the "pseudo" prefix would seem to denigrate this type of randomness as "not really" random, pseudo-randomness is generally acceptable, and in fact, desirable in many situations. For example, engineers running a computer simulation often need random variables, but they need those random variables ''to be the same'' with every run of the simulation; otherwise it is impossible to narrow down what process is actually being modeled in the simulation. Pseudo-random number generators are the only kind that are useful in hashing, since they allow data to be distributed widely but also placed in known locations.

Revision as of 18:35, 11 July 2011

View this revision of Randomness.

Personal tools