Skip to content

Latest commit

 

History

History
117 lines (65 loc) · 9.79 KB

Week05-Psuedoranomness2.md

File metadata and controls

117 lines (65 loc) · 9.79 KB

Lava lamps used to create random numbers: this version is re-creation of the 1996 original at Cloudflare, which is actually used to generate random numbers for encrypting customer data!

PSEUDORANOMNESS 2

This week we'll continue our look at randomness in the computer as a tool for creative work. But we'll also dig a bit deeper into what random really means. We know from last week that "random" numbers generated by the computer are really pseudo-random. In the words of computer pioneer John von Neumann: "Anyone who attempts to generate random numbers by deterministic means is, of course, living in a state of sin."

Von Neumann's now-famous quote was meant to highlight the fact that, even if we can't see a pattern, that doesn't mean one doesn't exist. But digging deeper into places where random numbers are really important, like cryptography, we find a long history of people trying to quantify how random a sequence of numbers actually is. In other words: we can measure randomness! Of course, a single number means nothing on its own, so researchers look at sequences of numbers and apply a variety of statistical tests to determine how random the sequence is.

The most famous example of this is Rand Corporation's 1955 book A Million Random Digits which is just that: a book of one million very random numbers. Having generated their numbers using a General Radio Company Type 1390-B Random Noise Generator (a tube-driven device meant for radio stations), the resulting values were subjected to four tests using a computer – a very slow a laborious process in the mid-1950s. Today, the Dieharder software suite (originally created by George Marsaglia) includes 80 different high-quality random number generators with some lovely names: threefish, transputer, superkiss, and R_super_duper. Programmer/artist kynd has this great website that visualizes some of these generation methods. Dieharder and the National Institute of Standards and Technology's Statistical Test Suite offer a range of tests with strange names: Chi-Squared, Monte Carlo Pi, OPERM5, STS Runs, and RGB Lagged Sums.

There are also analog means of generating very random numbers. Random.org's website has used two untuned FM radios, which pick up noise in the upper atmosphere, for many years; Lavarand similarly used lava lamp blobs and a webcam! Directly in the computer, entropy (essentially noise) from hard-drives has also been used.

In class today, we'll listen to some white noise (which is essentially random numbers turned into audio) generated using a variety of methods, then continue working in Processing. After Thanksgiving break, we'll wrap up our work in Processing by outputting your code drawings using a pen plotter, much like artists Vera Molnar and Manfred Mohr did with their own randomness explorations in the 1970s.

Above: lava lamps used to create random numbers: this version is re-creation of the 1996 original at Cloudflare, which is actually used to generate random numbers for encrypting customer data!

ACTIVITIES

  • Feedback session on proposals and work in progress
  • White noise listening session
  • Further Processing demos
  • Lunch break
  • Demos and work time
  • Homework

MORNING

Feedback session
We'll start the day by talking through your final project ideas and look at your work in progress.

White noise listening session
While it's clear that not all RNGs are equally random, can we really experience a difference? We'll listen to the output of four different random number generators converted to audio. "White noise" refers to audio where all frequencies are equally represented: random values in very fast succession. The four generators we'll listen to have different intended uses and their outputs have different properties. To best listen to them, try for "deep" listening below the surface. Try to hear differences in the frequency spectrum, intensity, overall tone, and the subtle patterns your brain imposes on random sound sources.

More info on the generators we listened to below!

Further Processing Demos
Today we'll be continuing our Processing demos, exploring ways that the random() function can be applied to drawing parameters like position, size, and color.


AFTERNOON

Further demos and work time
This afternoon we'll wrap up our Processing demos and have time for you to continue exploring randomness in code. In our next meeting, we'll be outputting some of these to the plotter, so you should aim for at least one drawing you're excited about and feels done by that time.


HOMEWORK

Reminder! Next week is Thanksgiving break so we won't be meeting. For our next class meeting in two weeks, please continue working on your final project. This is our last meeting before the final crit, so please be sure to put two week's work into the project: we should see considerable progress for our in-progress critique.

READING

For next time, please read the chapter from James Gleick's book The Information. It extends the reading from the same book last week but focuses on the ways scientists think of randomness as information-bearing and order as having very little information – a flip from what we might intuitively think. Please prepare 1–2 questions/responses we can discuss next week. In particular, think about the trajectory we've had this semester from chance to randomness to information.

There are also lots of optional readings in the folder for this week on the idea of information and entropy. This includes Claude Shannon's seminal 1948 paper A Mathematical Theory of Communication. Feel free to browse through them if that's of interest!


WHITE NOISE GENERATORS

Below is info on the white noise generators we listened to in class today...

Type 1390-B
(True random source, not cryptographically secure)
Built in the 1950s by General Radio Company, this lab-grade generator uses vacuum tubes to generate white noise. Of note, this generator was used by RAND Corporation for the creation of their seminal book A Million Random Digits, which was used extensively in statistics and scientific research for decades. The Type 1390-B has a fairly even frequency distribution with slight roll-off on the bottom end and a somewhat warm tube sound.

AES_OFB
(Pseudo-random source, cryptographically secure)
One of two high-end, “gold standard” contemporary algorithms used at the White Noise Boutique, AES_OFB was designed specifically for cryptographic use. Part of the Dieharder software suite created by George Marsaglia of Duke University, it has been extensively tested by mathematicians for randomness. AES_OFB is similar to Threefish, but tends to perform slightly better in localized tests for randomness. Of all the generators we will hear, AES_OFB has the harshest, brightest sound, hinting at its pure digital source.

Congruential
(Pseudo-random source, not cryptographically secure)
An early algorithm for generating pseudo-random numbers, the Congruential generator uses its previous output to feed into the algorithm and generate new values. Using specially chosen values in the equation, this generator can have a long period of generation before it repeats, though significantly less than the other algorithms heard tonight. A bit between the Type 1390-B and AES_OFB generators, Congruential sounds less harsh than newer algorithms, retaining a vintage quality.

dev/random
(True random source, cryptographically secure)
This generator is a mix of physical and algorithm, using entropy from the computer’s hard drive to feed a pseudo-random number generator. Like most cryptographic generators, slow generation is considered a positive quality, and dev/random will stop working until sufficient entropy is built up again. From the Mac OSX manual page for the function: “The quality of its output is however dependent on regular addition of appropriate entropy… Paranoid programmers can counteract this risk somewhat by collecting entropy of their choice.” The sound of dev/random tends to be clear but less harsh than AES_OFB.

We'll listen to five minutes of each of the generators, followed by one minute of silence in between each to "cleanse the palette."

WANT TO TRY DIEHARDER?

Installing the dieharder software from the site listed above can be tricky. If you're on a Mac, you can install it easily using homebrew, a command-line program.

First, install homebrew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then install dieharder:

brew install dieharder  

That's it! You can test the install by typing in dieharder --h — you should get instructions on the software. To test a file's randomness, type this command (replacing <filename> with the path to your file):

dieharder -a -f <filename>

This may take a while! Use the --h (help) command for more info and options.

WANT TO READ SOME HARD-DRIVE ENTROPY?

On a Mac (or Linux) you can also read hard-drive entropy, which is a great source of random numbers. In the Terminal, type:

echo $RANDOM

This will print one random value using /dev/urandom, a program built into your operating system. To create more values, try:

od -d /dev/urandom

This will continuously spit out random decimal numbers until you type control + c to stop it!