Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # list_fixed_shuffle.py
- import random
- items = ['a', 1, 'b', 'c', 2, 3, 'd', 'e', 'f', 4]
- fixed = sorted([1,4,5,9])
- trade = items[:]
- def fixed_shuffle():
- for fix in fixed:
- trade[fix] = ''
- while '' in trade:
- trade.remove('')
- random.shuffle(trade)
- for fix in range(len(items)):
- if fix in fixed:
- trade.insert(fix,items[fix])
- return trade
- #
- for demo in range(10):
- print fixed_shuffle()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement