Electronic Arts interview question

Weighted random function.