Archive for November, 2012

Random? Wanna bet?

Friday, November 23rd, 2012

I know this is really random, but the notion of random numbers has fascinated me for as long as I can remember. In my early BASIC programming days, I was delighted to find the RAND function. Mostly I used it to draw randomly colored dots in random places on the screen, and maybe even thought of actual uses for it (dice? checkbook balancing?) It was definitely a simpler time, software-wise.

Recently I mentioned to my patient spouse that I had just read an interesting way to create random numbers, and she responded, almost on cue, “Why would anyone want to create random numbers?” What a set-up. This post is my answer to her (Hi, honey.)

We benefit from random numbers, and their engineered counterparts, pseudo-random numbers, in many ways. When you play a game on your phone or computer, it uses unpredictable numbers to help it decide where to position troops on a battlefield, aliens in space, angry birds, or cards in a solitaire game, or how to respond to your last move. Many work-at-home folk use a thumb-sized device that allows remote computer access by showing a fresh new 6-digit security number every minute of every day until its battery runs out. Many forms of data encryption, such as those used by your on-line bank, also use un-guessable numbers to protect your data. You know the shuffle mode on your music player? Well, it’s sorta random. And, believe it or not, a respected method for solving an entire class of complex math problems requires the use of high-quality random numbers.

The astute reader (yes, you definitely qualify) has doubtlessly noticed that I used quite a collection of vague alternatives and adjectives for “random” in the preceding paragraph. Unpredictable, unguessable, secure, “sorta.” Pseudo-random. High-quality?

Let’s start with the music shuffler. It does use a pseudo-random number generator, but it also weighs in other factors. With a truly random number series, a given song might be played twice in a row, or even three times. Statistically, that should, on the average, take a long time. But if it happened, the listener would likely think the shuffler was broken, rather than thinking, “Hey, random!” So its algorithm precludes too-frequent repetition. Other factors it considers include which songs have already been played, and which ones you have listened to the most (that makes sense – it wants you to be happy.)

Security login and encryption keys, on the other hand, can’t be just “sorta random.” They have to be strictly predictable, because the number sent (by you, or by your secure browser) has to exactly match the number the other end is expecting.

Game play is a lot less taxing for a random number generator. Even if the solitaire program deals the exact same game twice in a row, only Rainman would be likely to figure it out. But if it did it four times in a row, even I might start to get suspicious.

So there are different requirements for different uses of random numbers. How does one control the quality of “randomness”, you might ask. Well, there’s one pretty clear dividing line. Numbers generated through the use of a computer algorithm, regardless of how clever, are pseudo-random at best. The series of numbers can always be repeated if you repeat the process with the same starting number, called the “seed.” This turns out to be useful for security applications, or even if you just want to try the same solitaire hand again.

To produce true randomness, some element of nature must be introduced. It may be something a simple as the passage of time. You could use time by letting the seed be your computer’s idea of how many seconds have elapsed since January 1, 1970, a popular starting point for Unix computer system clocks. There are other natural phenomena which can be exploited to produce true randomness. Some computer security systems generate a code based on the movements of the user’s mouse during a specified interval. Electronic circuits inherently produce random noise, like the sound you hear between AM radio stations. This noise is usually filtered out, but for random number generation, the noise can be extracted.

My favorite method of generating “true” random numbers was invented by Silicon Graphics employees Bob Mende, Landon Curt Noll, and Sanjev Sisodiya in 1996. They pointed a video camera at a rack full of lava lamps, and use the resulting pixelated randomness to create a string of random numbers. (I know you are thinking it: “What were they smoking?”)

In The Quark and the Jaguar, Murray Gell-Mann tells of being twice-surprised when he found a book of random numbers on a university shelf. He was surprised, first, that anyone would go to the trouble of printing a book of random numbers. Then he was further surprised when he found an errata sheet inserted into the book, because some of the random numbers on one of the pages were “wrong.” How can random numbers be wrong? (I suppose it’s asking deep questions like that that gets you on the path to being a world-class theoretical physicist.)

Perhaps the easiest way to explain the importance of good random numbers is to describe the Monte Carlo method of solving complex problems. The method was invented in the 1940s by John von Neumann, Stanislaw Ulam and Nicholas Metropolis, while they were working on nuclear weapon projects (Manhattan Project) in the Los Alamos National Laboratory. It was allegedly named for the casino where one of Ulam’s relatives consistently lost all of his money.

The Monte Carlo method applies when many unpredictable factors can affect an outcome. The theorist establishes or hypothesizes a formula describing the behavior of a system. Then the theorist uses a large set of random inputs to see how the “system” reacts to them. If the reaction makes sense to the theorist, then the formula has value.

Here’s where the tricky part comes in. If the random number are not truly random, that is, if they are biased in some way, the results of the analysis are not trustworthy. The example in Wikipedia link above shows how the Monte Carlo method can be used to calculate the value of pi. If you inscribe a circle in a square, the area of the circle divided by the area of the square is pi/4. You can calculate whether a given point is inside or outside the circle.

If you then pick a uniform distribution of points scattered across the area of the square, you can calculate an approximation of pi. But if the distribution is not uniform (that is, not truly random) the approximation will be off.

If you are interested in more details, you can find a “Monte Carlo thought experiment” and my own Monte Carlo computer simulation, RIGHT HERE.

My goodness, this post has taken a rather pedantic turn. I don’t suppose it would help to start musing about the psychosocial implications of preferring randomness, rather than predictability. Fortunately I’m not the only one: just look at the stars!

Let’s save that for another time. I’ll close with a wish for you, that your life will be predictable enough to be comfortable, and random enough to be fun!

Eyeballs

Saturday, November 10th, 2012

Recently I tweeted this deep thought: Reminder: Commercial television stations produce ENTERTAINMENT. They base content and broadcast decisions on “eyeballs.” Bear that in mind.

A twitter follower whose tweets are always thoughtful and interesting quickly sent the following reply: True. Honest question, not a challenge: what alternative do you propose? PBS?

I actually enjoy the challenge of trying to conveying a concise and complex thought within twitter’s 140-character limit. But serious thoughts are particularly difficult, so I usually stick to lame attempts at humor or even lamer social observations.

Here’s what I replied: Very good question. My intent was to encourage consumers to analyze what they see and hear from a fresh, critical perspective.

But, of course, that barely scratched the surface of everything behind the original innocuous-sounding comment.

So here’s a longer response.

First, I almost left out the word “commercial”, since Public Broadcasting Stations really have the same need for funding. They just approach it a different way. I do confess that when I must have linear video to test something at work, I tune to the local PBS station, because it is always SFW (safe for work), and has virtually no advertising. Which, of course, is one of the meanings of “commercial”.

To further complicate my thoughts on TV, I am quite un-fond of advertising in any way, shape or form. I understand the need for advertising, and there are, of course, some ad campaigns that even I will watch, such as the old Mac vs PC ads. But I don’t like broadly cast ads. (Of course, television advertising is changing, thanks to internet video and dvrs, forcing advertisers to be ever more creative and focused. We’ll save that for another post.)

The reality is, I don’t watch much TV of any sort, certainly less than the national daily individual average, which is just north of 4 hours per day. That’s average, meaning that half the country watches more than that!

It’s not that I don’t like television – more like the reverse. Apparently I am irresistibly drawn to its images, more so than most folks. Often, even into my adulthood, my dad would comment that I seemed to get lost in the television, even while we were trying to talk. I have been in many houses where the TV would run continuously in the background, through dinner and conversation. Frankly, it nearly drove me crazy: I wanted to yell, “Either watch it or turn it off!!!”

I suppose it is a natural side effect of this attraction that video content almost always produces some sort of deep, visceral reaction in me, especially intense action scenes. My heart races. I feel responsible. I am immersed.

There is no small irony here. My current job includes work on interactive television applications; there is at least one television in every cubicle on my floor. I am surrounded by television. Even in my boss’ office, I am drawn to the monitor behind her. I have to force myself to focus on our conversation.

Yet, despite this direct connection to my brain, I do not find video to be an efficient form of information transfer for me. It is clearly good for a few, very visual topics, but generally I would much rather have a thick, well-organized document to read through, scan, pore over.

At home I do watch a few shows, mostly joining my infinitely patient spouse, who has learned that Big Bang Theory or Doctor Who will almost always entice me away from whatever else I am doing at the time.

OK, it’s time to stop this awkward self-analysis and get back to my tweet interchange. My thinking in this area goes back to my first noticing the phenomenon of day-time radio commentators. These folks are given hours per day to fill, and fill them they do. Even though I did not listen much, I often heard reports of their internal inconsistencies and outlandish claims, and noticed their dedicated listeners. It all perplexed me. Then one day I heard someone say that they are not really doing news reporting or analysis – they are attracting listeners, and they say whatever they need to say to keep those ears. All of a sudden, it made sense to me. They are entertainers.

It seems to me that advent of the 24-hour television news stream, coupled with near-instantaneous transmission of even the most minor events, on a world-wide scale, has produced a similar effect. The news channels are obligated to fill their air space whether the information density of the day warrants it or not. If it is a “slow news” day, they find something to talk about, which unavoidably amplifies the importance of whatever they focus on.

Years ago I read that the value of content (what I’ll call “information quotient”, or IQ) is proportional to the time required to produce the content in the given format. The IQ of a news article is less than a magazine article, which is less than a book. That observation hasn’t really changed much, even as technology has provided new forms of content distribution. Tweets are low-IQ, blogs are higher, but they are less than news articles (especially if you consider additional quality-increasing factors such as group review and editing.) A multi-part television documentary may actually contain more IQ than a book.

Lately I have heard stories of people who say they want to cut off their cable service. They have become super-saturated. I certainly understand – like many people, I had to put myself on an “internet information diet” during the last few weeks leading up to the election.

So I guess that leads me back to the recommendation that I so foolishly tried to summarize in 140 characters. There is so much more you can do with your time than watching television. Go outside. Organize your life and/or house. Read. Write. Think. Invent. Teach. Learn. Meditate. Draw. Paint. Rhyme. Converse. Sleep.

And when you do consume content, budget your eyeball time and your eardrum time. Try to round out your diet – try a station or genre you don’t usually watch or listen to. Feel free to enjoy your “comfort food” content, but make sure you’re getting some information “vitamins,” too.

Bon appetite.