Simplified pickRandom by using more primitives.