Numbers by color … (instead of color by number)

While randomness has been used in music composition at least since the 18th European century games, randomness and arbitrariness both became crucial aspects of art and music starting in the 20th century. , Dadaism was perhaps the first movement to incorporate both, followed by Surrealism. In the late 20th century algorithmic art (though I don’t find that Wikipedia description satisfying) often incorporates randomness.

My own view is that *in general* arbitrariness is more interesting than randomness. In the domain of text for example, I find the randomness of the Dada cutup less interesting than the arbitrariness of the Surrealist exquisite corpse or the textoems of Otto Poe Trea.

So what is the difference between *arbitrary* and *random*? In informal usage, not much. English (and Hebrew according to my friend Eran Raveh) uses them more or less interchangeably. The Merriam-Webster dictionary in fact gives these two (partial) definitions for *random*:

1a. lacking a definite plan, purpose, or pattern

2a. relating to, having, or being elements or events with definite probability of occurrence

and this definition (of 3) for arbitrary:

1a. existing or coming about seemingly at random or by chance or as a capricious and unreasonable act of will1b. based on or determined by individual preference or convenience rather than by necessity or the intrinsic nature of something

(While my impression is that “random choice” is more common than “arbitrary choice”, Google Ngrams indicates just the opposite.)

However, I think it is useful to distinguish the more mathematical notion of randomness (*random* #2a) above from a notion of arbitrariness that is akin to (*arbitrary* #1b), where an arbitrary choice is based on factors that are not mathematically random, but which depend in part on individual choice.

Words, words, words, … show me!

Here’s a simple method for coloring a grid, like a checkerboard.

- We’ll color each square of the grid in order, row by by row, starting at the top left, moving left to right, and then down to the next row.
- We choose the color for a square as follows: we flip a coin and if it is heads, we color the square blue, and if it is tails, we paint it yellow.

The choice between blue and yellow is **random**, since it is determined by the random coin flip. (Using blue and yellow as the colors is neither random nor completely arbitrary, since I chose them because they are complementary colors and because I like the combination.) Here’s the beginning of coloring an 8×8 grid that I determined by flipping a penny 10 times.

H | T | H | H | H | H | H | H |

T | H | … | … | … | … | … | … |

Flipping a coin gets pretty tedious, and if we have a big grid, it’s **really** tedious, which is what computers are for. Here’s a grid that is 513 x 513 (263,169 squares — that’s a lot of flipping!), colored as above using the random number generator in Javascript to simulate the coin flips. In this grid, 50.1% of the squares are blue, which is pretty close to the 50% we expect from a (fair) coin toss. Nice colors, but it’s not particularly interesting visually, in my opinion.

A major theme in my artistic work is *Revisualizing the Visual*. I write programs which I use as **tools** to carry out my **algorithms** that transform photographs into other images. We can do that same thing here by using a photograph to generate ** arbitrary numbers** instead of random numbers. Here’s how:

- We start with a photograph.
- We pick a number,
*N*, which is less than the number of pixels in the photograph. - We scan the photograph left to right, top to bottom (the same order as we fill the grid).
- At every
*Nth*pixel we determine a color for the next square in the grid as follows:- If the brightness (that’s the number from a color) is less than the middle of the brightness range in the photograph, we color the square blue
- Otherwise we color the square yellow.

- If we run off the bottom row, we wrap around to the top row.

Let’s see how that works. Here’s a photo that I took (it’s actually a smaller version of the one I used to color the grid).

Flowers in Vancouver, British Columbia. © 2007 Chris Culy

The original photo has a width of 2,304 pixels and a height of 3,072 pixels for a total size of 7,077,888 pixels. Let’s pick *N* to be one quarter of the width: 576. So we’ll use the luminance of every 576th pixel to choose blue or yellow for the grid. Here’s what we get for our 513×513 grid. 79.35% of the squares are blue this time, far from the 50% expected of a random choice (you don’t want to call “tails” with this one!). OK, it’s not amazingly exciting, but it’s better than the random example above.

What we see in the colored grid is the result of a combination of *arbitrary* factors, including, but not limited to:

- the choice of the photograph (a different photograph would give different results)
- the structure present in the photograph
- the choice of the N to be 576
- the choice of the width of the grid

In addition to being a bit more interesting, another benefit of this arbitrary approach (which is not available with a random number generator) is that we can make different arbitrary choices and get different results. For example, if we choose N to be 5,308,417 (one more than 3/4 of the total size) and make no other changes we get this grid, which has 69.21% blue squares (a bit lower than the one above), and which has a very different appearance from the previous one. Again, not amazingly exciting, but still better than the purely random one.

Although simple random numbers often don’t produce interesting results, a more complex approach is to *combine* random numbers to create what is called *noise. *People have used noise in to make some spectacular visual effects. In a way, noise is an attempt to **model** the structured, non-uniform nature of the world. On the other hand, when we use photographs to create arbitrary numbers, we are using an approximation of the structure of (a part of) the world itself (via the image), not just a model. With the noise models, we have more control over the outcome via parameters, which may be desirable in many contexts. However, I find the photographic arbitrary approach more satisfying from an conceptual perspective. [It would be interesting to substitute arbitrary numbers for the random numbers in noise, but I haven’t tried that, yet.]

Even though these photographs are images of the world, they are not 100% faithful to the world. Although this is well known, it is worth reiterating that the colors in a photograph only approximate the colors in the world (and how we perceive them, which differs from person to person). Furthermore, the pixels are discrete, while the world is (at our level of perception) continuous — there are no gaps in what we see in the world. However, even though the photographs are not 100% faithful to the world, they are a close enough approximation to provide our arbitrary numbers.

I hope that I’ve convinced you that *arbitrariness* is more interesting than *randomness*, or at the very least, that it is worth considering as an alternative. In a future post, I’ll show how I was able to get more artistic from this basic start, which I originally intended just to be an exercise.

I’ll have a followup post with some technical details for those so inclined.

## Acknowledgments

Two programming environments greatly expanded my artistic programming (aka creative coding). The first was HyperCard, which was easy to learn and easy to use, though not designed for artistic programming. I did a lot of dabbling in algorithmic art, as well even more practical research programming in HyperCard.

The second environment was Processing, invented by Casey Reas (see his site) and Ben Fry (see his site). Their examples, and later examples also in Processing by Daniel Shiffman (see his site) were tremendously influential in my thinking about algorithmic art, and in using images as an input, though I have not have the pleasure of meeting or interacting with them. Ben Fry’s work in Processing also got me started on data visualization, which you can find on my main site.

If you are interested in exploring creative coding, I highly recommend any of the Processing environments. (However, I wrote the program for these examples in pure Javascript.)