Freshworks Interview Question

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