Freshworks interview question

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