nums
and store it.reset
the array, simply return the stored original array.shuffle
the array, iterate over the array from the first index to the second to last index.i
, generate a random index j
such that i <= j < n
where n
is the length of the array.i
and j
.