小编Tet*_*ed_的帖子

random.shuffle() 的倒数?

我有一个函数,为简单起见,我将其称为 shuffler,它需要一个列表,随机给出一个种子 17,然后打印该列表。

def shuffler( n ):
   import random
   random.seed( 17 )
   print( random.shuffle( n ) )
Run Code Online (Sandbox Code Playgroud)

我将如何创建另一个名为 unshuffler 的函数,该函数“解混”由 shuffler() 返回的列表,假设我知道种子,将其带回到我输入到 shuffler() 的列表中?

python random python-3.x

9
推荐指数
2
解决办法
4498
查看次数

标签 统计

python ×1

python-3.x ×1

random ×1