classSolution{int[] nums;int[] backNums;// 数组备份publicSolution(int[] nums){this.nums = nums;
backNums = nums.clone();}/**
* Resets the array to its original configuration and return it.
*/publicint[]reset(){
nums = backNums.clone();return nums;}/**
* Returns a random shuffling of the array.
*/publicint[]shuffle(){int n = nums.length;
Random random =newRandom();for(int i =0; i < n; i++){int p = random.nextInt(n);int temp = nums[i];
nums[i]= nums[p];
nums[p]= temp;}return nums;}}/**
* Your Solution object will be instantiated and called as such:
* Solution obj = new Solution(nums);
* int[] param_1 = obj.reset();
* int[] param_2 = obj.shuffle();
*/