Calculating the Birthday Paradox

For the last couple years I’ve been working on a program that generates a large number of essentially random ID strings (it’s actually a replicated document storage system that uses the hash of a file’s content as its ID, but the details don’t matter). Since IDs are independently generated there will always be some chance that two different files will just happen to have the same ID assigned — so how long do I need to make my ID string before that probability is small enough that I can sleep at night?

This is essentially the Birthday Paradox, just with bigger numbers and in a different form. For those who haven’t heard of it, the canonical form of the Birthday Paradox asks what the probability is that, out of a random group of 23 people, at least two in share the same birthday. (The “paradoxical” part is that the answer is just over 50%, much higher than most people’s intuition would suggest.) My question just turns that around and asks “how many random N-bit IDs have to be generated before there is a one in a million chance of any two of them being identical?”

Rejiggering the formulas given in Wikipedia, here’s the approximation:

n ≅ (-2 · S · ln(1 – P))1/2

where:

  • n is the number of entities required to reach the given probability
  • P is the probability desired
  • S is the size of the set of all possible entities

For example, the number of people you would need for a 50% chance that at least two of them have the same birthday is (-2 · 365 · ln(1/2))1/2, or between 22 and 23 people. As a more practical example, you would only need to generate 77,163 PGP keys before having a 50% chance of a collision between their 8-character short-form fingerprints.

As for my one-in-a-million chance, you’d need to randomly generate roughly 2(N – 19)/2 N-bit strings before having a one-in-a-million chance of a collision, which means I would need to randomly generate around 270 of my 160-bit ID strings before there would be a one-in-a-million chance of having a collision. I think I can sleep at night.

Calculating the Birthday Paradox Read More »

iPhone fix: blow out the lint

Here’s a simple iPhone fix that others may appreciate. A few weeks ago my microphone started to cut out — I could listen to music over the headphones, but with both pairs of earbuds the microphone would cut out, and disconnecting and reconnecting them would cause the call to drop. I finally took it to the Genius Bar today and they immediately took out an otoscope and discovered that the hole where the headphone jack fits in was filled with pocket lint! One quick burst of compressed air later and it was working perfectly again! (Apparently they get this problem a lot, as they’ve got a special mini-jack attachment for their compressed air can.)

A nice side effect was he noticed the screen’s hairline crack I’d gotten when the phone fell out of my pocket. From all I’d read on the Net I thought I’d have to pay $250 to have that repaired, but he said so long as it was just a single hairline crack and there was no damage to the case itself they could do a warranty replacement — five minutes later I was walking out of the store with a fresh-out-of-the-box iPhone.

iPhone fix: blow out the lint Read More »

A study in CUTE!

This should be interesting:

Designing Cute Interactive Media
in conjunction with The ACM conference on Designing Interactive Systems

Cuteness has an effective design philosophy that can be used in many areas to make emotionally engaging user interactive systems, as well as evaluate existing systems. Cuteness can also be included as an engineering design framework that can assist designers and engineers when creating engaging interactive systems that motivate the user in a happy, positive manner.

The main goal of this workshop is to provide designers with a better understanding of developing ways to enhance the positive experience and effectiveness of interactive media by utilizing the psychological and culturally developed effects of cuteness. We would also like to explore a range of interactive experiences involving the idea of cuteness and examine the related components. Based on these experiences, the next generation user interfaces can be built to take advantage of the cuteness factor and its unique effects on the experience which can establish and maintain more meaningful relationships with the users and encourage happiness, self confidence, motivate the user to action, and provide overall positive experiences.

A study in CUTE! Read More »

Kindle playing the game backwards?

My coworker Steve Savitzky has some interesting musings on the Kindle, Amazon’s new ebook reader:

If you want everyone else’s opinion, see the links after the cut. Here’s mine: interesting play, but it’s in the wrong game.

You see, Kindle is Amazon’s attempt at an iPod for books. They’re using what they hope is an elegant, convenient, and reasonably-priced piece of hardware (which I’d guess that they’re selling at pretty close to cost when you factor in the pre-paid data plan) to sell digital copies of books (which are fairly expensive considering all the atoms they don’t have to handle compared with their dead-tree counterparts).

Apple, on the other hand, is using convenient access to an extensive collection of audio tracks (which they sell at pretty close to cost) to sell a particularly elegant and convenient, but overpriced, piece of hardware. Apple isn’t even in the hardware business, really: they understand that they’re in the fashion business, and have made it really easy for other companies to sell accessories for iPods.

Hands up, who’s going to build fashion accessories for the Kindle? Don’t all speak at once… How many people are going to buy a Kindle for each of their kids? Is anybody going to let their kids loose on a piece of hardware that lets them buy books at $10/pop at the click of a button? That’s what I thought.

Sounds pretty spot-on to me…

Kindle playing the game backwards? Read More »

Installing emacs23 with X11 support on Leopard

For some reason Fink has not yet updated their version of GNU emacs. While there are several other options, including Aquamacs, xemacs from Fink and the terminal-only emacs that comes pre-installed on OSX, I missed my traditional GNU Emacs running over X11. Luckily, with a few tweaks to this guide, the process was pretty painless — assuming you’ve already got Fink installed, just do the following (all from the Terminal):

 mkdir tmp cd tmp cvs -z3 -d:pserver:anonymous@cvs.sv.gnu.org:/sources/emacs co emacs cd emacs fink install libungif libjpeg libtiff export LIBS="-lresolv" ./configure --without-carbon --with-x --prefix=/usr/local make bootstrap make sudo make install cd /usr/local/bin/ sudo ln -s emacs emacs23 

Installing emacs23 with X11 support on Leopard Read More »

Book chapter in “Extending Intelligence”

Back in 2001 I was a guest speaker at the Third International Spearman Seminar on Extending Intelligence, a seminar hosted by the Educational Testing Service’s R&D Division and Sydney University’s Department of Psychology. Most of the other speakers were either from the field of education or psychology, but I and a couple other speaker were brought in to provide a view from outside the field. I’m pleased to say those talks have finally been turned into a textbook, Extending Intelligence: Enhancement and New Constructs, including my own chapter “Challenges and Opportunities for Intelligence Augmentation.”

Book chapter in “Extending Intelligence” Read More »