fork download
  1. from random import randint
  2.  
  3. arr = [1, 2, 3, 3, 0, 55]
  4. index = []
  5. for i in range(len(arr)):
  6. n = randint(0, len(arr))
  7. while n == i or n in index:
  8. n = randint(0, len(arr))
  9. index.append(n)
  10. print(index)
Success #stdin #stdout 0.03s 9916KB
stdin
Standard input is empty
stdout
[5, 3, 0, 1, 2, 6]