1import random
2class Solution(object):
3 def __init__(self, nums):
4 self.original = [x for x in nums]
5 self.temp = nums
6 self.indices = [x for x in range(len(nums))]
7 def reset(self):
8 return self.original
9 def shuffle(self):
10 if not len(self.temp):
11 return []
12 i = random.choice(self.indices)
13 j = random.choice(self.indices)
14 self.temp[i], self.temp[j] = self.temp[j], self.temp[i]
15 return self.temp
16ob = Solution([1,2,3])
17print(ob.shuffle())
18print(ob.reset())
19print(ob.shuffle())