Pregunta de entrevista de Freshworks

Return a random value from array with probability proportional to its value