Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

以秒为随机种子和以毫秒为随机种子和以十亿份之一秒为随机种子生成的伪随机数有什么不同吗


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
278 views
Welcome To Ask or Share your Answers For Others

1 Answer

几乎没有不同,不同在于ns的随机种子相同撞车的概率最低。

只有随机种子值不同随机数据才会不同,如果随机种子值相同按照相同顺序去随机,随机出来的值一模一样,例如我自己的主站默认就没随机种子,每次测试重启服务后第一个验证码是通一个值。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...