我正在使用字符串散列以以下方式为随机状态设定种子:
context = "string"
seed = hash(context) % 4294967295 # This is necessary to keep the hash within allowed seed values
np.random.seed(seed)
不幸的是(对于我的使用)在Python 3.3和更高版本中的运行之间是不确定的。我知道我可以将PYTHONHASHSEED
环境变量设置为一个整数值来重新获得确定性,但我可能更喜欢感觉不那么麻烦的东西,并且不会完全忽略随机散列增加的额外安全性。建议?
目前没有回答
相关问题 更多 >
编程相关推荐