SHARE
TWEET

Untitled

a guest May 23rd, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from random import randint
  2.  
  3. class Solution:
  4.     def __init__(self, nums: List[int]):
  5.         self.orig = list(nums)
  6.         self.shuf = list(nums)
  7.  
  8.     def reset(self) -> List[int]:
  9.         return self.orig
  10.  
  11.     def shuffle(self) -> List[int]:
  12.         n = len(self.shuf)
  13.         A = self.shuf
  14.         for i in range(n):
  15.             j = randint(0, n-1)
  16.             A[i], A[j] = A[j], A[i]
  17.         return A
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top