12345678910111213141516171819202122 |
- #!/usr/bin/env python2
- import time, random, decimal, sys
- ticks = 0.0
- random.seed(0.0)
- def GetInteger(min, max):
- global ticks
- currentTicks = time.time()
- if currentTicks != ticks:
- ticks = currentTicks
- random.seed(ticks)
- return int(round(min + decimal.Decimal(random.random()) * (max-min)))
- def SortRandom(inputList):
- output = []
- while len(inputList) > 0:
- index = GetInteger(0, len(inputList) - 1)
- output.append(inputList[index])
- del inputList[index]
- return output
|