本文介绍了在iphone sdk播种arc4random()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从我可以收集的内容arc4random()生成比rand()更好的随机数,但是我还没有看到种植它的方法,而我想就像使用srand一样()。有办法吗?

From what I can gather arc4random() generates much better random numbers than rand() does, however I haven't seen a way to seed it, and I would like to just like using srand(). Is there a way?

推荐答案

这不是arc4random的设计目的。正如文档所述:

That's not what arc4random is designed to do. As the documentation states:

因为无论如何它都是从熵源重新播种,你手动播种它并没有获得任何好处,事实上,这种方法不存在。

Since it is re-seeds itself from an entropy source anyway, you gain nothing by seeding it manually, and in fact, such a method does not exist.

这篇关于在iphone sdk播种arc4random()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 04:04