This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def shuffle(target:list,seed:int = None): | |
#洗牌算法 | |
#https://www.jianshu.com/p/512fa876199b | |
random.seed(seed)#设置随机数种子,默认不设置 | |
for change in range(len(target) - 1, 0, -1): | |
lower = random.randint(0, change) | |
target[lower], target[change] = target[change], target[lower] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def shuffle(target:list,seed:int = None): | |
#洗牌算法 | |
#https://www.jianshu.com/p/512fa876199b | |
random.seed(seed)#设置随机数种子,默认不设置 | |
for change in range(len(target) - 1, 0, -1): | |
lower = random.randint(0, change) | |
target[lower], target[change] = target[change], target[lower] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import re | |
str1 = ' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' | |
str2 = '~!@#$%^&*()_+`-={}|[]:;<>,.?/' | |
str3 = "'" | |
str4 = '"' | |
string = str1 + str2 + str3 + str4 | |
lst = list(string) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import re | |
str1 = ' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' | |
str2 = '~!@#$%^&*()_+`-={}|[]:;<>,.?/' | |
str3 = "'" | |
str4 = '"' | |
string = str1 + str2 + str3 + str4 | |
lst = list(string) |