Pregunta de entrevista de Two Sigma

Return an element with specified probability.