Randomness

From Maze

(Difference between revisions)
Jump to: navigation, search
Line 118:Line 118:
[[Image:10print-startup-canonical.png|160px|thumb|The first page of output from 10 PRINT when run immediately after startup.]]
[[Image:10print-startup-canonical.png|160px|thumb|The first page of output from 10 PRINT when run immediately after startup.]]
−
RND is, like most computational sources of randomness, a pseudorandom number generator. While there may be no apparent pattern between any two numbers, each number is generated based on the previous one using a deterministic process. When the first number is the same, the entire sequence will always be the same. In the case of the Commodore 64, this is particularly important because the same seed and thus the same first number is set startup. This means that, when RND(1) is invoked immediately after startup, or before any other invocation of RND, it will always produce the same result: 0.185564016. The next invocation will also be the same, no matter what Commodore 64 is used or how long the system has been on. The next invocation -- and all others -- will also be the same. Since the sequence is deterministic, the pattern produced by the 10 PRINT program typed in and run as the first program is always the same, on every computer or well-functioning emulator.
+
RND is, like most computational sources of randomness, a pseudo-random number generator. While there may be no apparent pattern between any two numbers, each number is generated based on the previous one using a deterministic process. When the first number is the same, the entire sequence will always be the same. In the case of the Commodore 64, this is particularly important because the same seed and thus the same first number is set startup. This means that, when RND(1) is invoked immediately after startup, or before any other invocation of RND, it will always produce the same result: 0.185564016. The next invocation will also be the same, no matter what Commodore 64 is used or how long the system has been on. The next invocation -- and all others -- will also be the same. Since the sequence is deterministic, the pattern produced by the 10 PRINT program typed in and run as the first program is always the same, on every computer or well-functioning emulator.
When called on ''any'' positive number, as when RND(1) is invoked in 10 PRINT, RND produces the next number in this sequence. RND(8), RND(128), or RND(.333) do exactly the same as RND(1). However, RND has two other modes besides the one used in 10 PRINT. The second is stopwatch-based: when RND(0) is called, the clock time since the computer was powered on is used in generating a new seed, meaning that if RND(0) replaces RND(1), each run 10 PRINT at a different second should generate a different output. After a single call to RND(0), subsequent calls to RND(1) will continue generating numbers in that new sequence.
When called on ''any'' positive number, as when RND(1) is invoked in 10 PRINT, RND produces the next number in this sequence. RND(8), RND(128), or RND(.333) do exactly the same as RND(1). However, RND has two other modes besides the one used in 10 PRINT. The second is stopwatch-based: when RND(0) is called, the clock time since the computer was powered on is used in generating a new seed, meaning that if RND(0) replaces RND(1), each run 10 PRINT at a different second should generate a different output. After a single call to RND(0), subsequent calls to RND(1) will continue generating numbers in that new sequence.
Line 124:Line 124:
The third mode for RND applies when any negative number is called. A call to RND(-17) stores -17 as the seed value for the random number generator, directly, and produces a new number. This negative seeding must be followed by positive RND(1) calls in order to provide a useful sequence. Because negative calls simply set the seed, calling RND(-0.123) repeatedly will always return 0.544630526. For this reason, 10 PRINT could not be a single-line loop that calls a negative RND value; that program would output the same diagonal again and again. However, a single call to any negative number, followed by running the normal 10 PRINT program, will generate a unique (and repeatable) 10 PRINT pattern.
The third mode for RND applies when any negative number is called. A call to RND(-17) stores -17 as the seed value for the random number generator, directly, and produces a new number. This negative seeding must be followed by positive RND(1) calls in order to provide a useful sequence. Because negative calls simply set the seed, calling RND(-0.123) repeatedly will always return 0.544630526. For this reason, 10 PRINT could not be a single-line loop that calls a negative RND value; that program would output the same diagonal again and again. However, a single call to any negative number, followed by running the normal 10 PRINT program, will generate a unique (and repeatable) 10 PRINT 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. Pseudorandom number generators are also highly useful in hashing, since they allow data to be distributed widely but also placed in known locations. Similarly, they are useful in cryptography, where it is vital that sequences be repeatable if (and only if) the initial conditions are known.
+
While the "pseudo" prefix would seem to denigrate this type of randomness as "not really" random, pseudo-randomness is generally acceptable and in many situations desirable. Engineers running a computer simulation, for example, 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. Pseudo-random number generators are also highly useful in hashing, since they allow data to be distributed widely but also placed in known locations. Similarly, they are useful in cryptography, where it is vital that sequences be repeatable if (and only if) the initial conditions are known.
−
The ''Commodore 64 Users Guide'' introduces the concept of randomness using an example that sidesteps the origins of randomness in computing. There is no mention of the hydrogen bomb, computer-generated literature, or prime numbers. Randomness comes into play in the shape of a game, when it is necessary to, as the manual puts it, "simulate the throw of dice" (48). This example that takes us back to pre-industrial notions of randomness. Yet, centuries ago, Sir Walter Raleigh wrote of a throw of the dice as apocalyptic -- long before Mallarmé assured us that it would not abolish chance: "Dead bones shall then be tumbled up and down, / In every city and in every town." Fortune's wheel and what Paul Auster called ''The Music of Chance'' have long been considered a life and death matter. As 10 PRINT scrolls its playful, pleasing maze pattern upon the screen, there may be the faintest echo of the dead bones of the dice and the random simulation of the hydrogen bomb. And perhaps, as well, there is the transformation of this grim, military use of randomness into a thing of beauty.
+
The ''Commodore 64 Users Guide'' introduces the concept of randomness using an example that sidesteps the origins of randomness in computing. There is no mention of the hydrogen bomb, computer-generated literature, or prime numbers. Randomness comes into play in the shape of a game, when it is necessary to, as the manual puts it, "simulate the throw of dice" (48). This example takes us back to pre-industrial notions of randomness. Yet, centuries ago, Sir Walter Raleigh wrote of a throw of the dice as apocalyptic -- long before Mallarmé assured us that it would not abolish chance: "Dead bones shall then be tumbled up and down, / In every city and in every town." Fortune's wheel and what Paul Auster called ''The Music of Chance'' have long been considered a life and death matter. As 10 PRINT scrolls its playful, pleasing maze pattern upon the screen, there may be the faintest echo of the dead bones of the dice and the random simulation of the hydrogen bomb. And perhaps, as well, there is the transformation of this grim, military use of randomness into a thing of beauty.
== Works Cited ==
== Works Cited ==
Line 134:Line 134:
Bennett, Deborah. 1998. ''Randomness''. Cambridge Mass.: Harvard University Press.
Bennett, Deborah. 1998. ''Randomness''. Cambridge Mass.: Harvard University Press.
−
Boyle, Neil. 1986. Random Numbers In Machine Language For Commodore 64. Compute! no. 72: 77. http://www.atarimagazines.com/compute/issue72/random_numbers.php
+
Boyle, Neil. 1986. Random Numbers In Machine Language For Commodore 64. ''Compute!'' no. 72: 77. http://www.atarimagazines.com/compute/issue72/random_numbers.php
Brecht, George. 1966. ''Chance Imagery''. A Great Bear Pamphlet. New York: Something Else Press.
Brecht, George. 1966. ''Chance Imagery''. A Great Bear Pamphlet. New York: Something Else Press.
Line 140:Line 140:
Burroughs, William S. 2003. The Cut-Up Method of Brion Gysin. In ''The New Media Reader'', ed. Noah Wardrip-Fruin and Nick Montfort, 90-91. Cambridge, MA: The MIT Press.
Burroughs, William S. 2003. The Cut-Up Method of Brion Gysin. In ''The New Media Reader'', ed. Noah Wardrip-Fruin and Nick Montfort, 90-91. Cambridge, MA: The MIT Press.
 +
Cage, John. ''Silence.'' Cambridge, Mass.: MIT Press, 1966
 +
Caillois, Roger. 2003. ''Man, Play, and Games''. Trans. Meyer Barash. New York: The Free Press.
Caillois, Roger. 2003. ''Man, Play, and Games''. Trans. Meyer Barash. New York: The Free Press.
−
 
−
Cage, John. ''Silence.'' MIT Press, 1966
 
Dreiser, Theodore. ''Sister Carrie''. New York: Penguin. 1981.
Dreiser, Theodore. ''Sister Carrie''. New York: Penguin. 1981.
−
Ekeland, Ivar. 1996. ''The Broken Dice, and Other Mathematical Tales of Chance''. University of Chicago Press, June 15.
+
Ekeland, Ivar. 1996. ''The Broken Dice, and Other Mathematical Tales of Chance''. Chicago, Ill.: University of Chicago Press, June 15.
Felder, H. 1968. The GPSS/360 random number generator. In Proceedings of the second conference on Applications of simulations, 21–28.
Felder, H. 1968. The GPSS/360 random number generator. In Proceedings of the second conference on Applications of simulations, 21–28.

Revision as of 12:08, 17 July 2011

View this revision of Randomness.

Personal tools