I use the Birthday Paradox when I'm searching for matching socks in the morning -- rather than pick a sock and look for one that matches it, I accumulate socks and choose the first pair that match.
My other favorite programming metaphor is about skiplists: they're like a set of subway lines, with some extra express lines that skip a random (and increasing, for each level) number of stops.
instead of casting other types, just make everything a string: buy a whole lot of pairs of the same type of sock so you don't have to worry about matching types!