Implement weighted random index picker | Meta Interview Question