SHARE
TWEET

Untitled

a guest Apr 24th, 2019 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random
  2.  
  3. def rand_arrange(max_size):
  4.     order_list = [False] * max_size
  5.     index_list = [-1] * max_size
  6.  
  7.     for i in range(max_size):
  8.         while True:
  9.             rand_var = random.randint(0, max_size - 1)
  10.             if order_list[rand_var]:
  11.                 continue
  12.             else:
  13.                 index_list[i] = rand_var + 1
  14.                 order_list[rand_var] = True
  15.                 break
  16.  
  17.     return index_list
  18.  
  19. print(rand_arrange(41))
  20. #rand_arrage(填最長編號)
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