Apple interview question

how to randomly shuffle an array given a function that can sample a random integer between 0 and n