progress in removing core
This commit is contained in:
parent
e12781a49d
commit
e1676ef168
21 changed files with 152 additions and 477 deletions
13
onionr/onionrcrypto/cryptoutils/randomshuffle.py
Normal file
13
onionr/onionrcrypto/cryptoutils/randomshuffle.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import secrets
|
||||
def random_shuffle(theList):
|
||||
myList = list(theList)
|
||||
shuffledList = []
|
||||
myListLength = len(myList) + 1
|
||||
while myListLength > 0:
|
||||
removed = secrets.randbelow(myListLength)
|
||||
try:
|
||||
shuffledList.append(myList.pop(removed))
|
||||
except IndexError:
|
||||
pass
|
||||
myListLength = len(myList)
|
||||
return shuffledList
|
||||
Loading…
Add table
Add a link
Reference in a new issue