且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iPhone上的srand(time(null))不起作用=(

更新时间:2023-02-03 12:55:07

在iOS和OS X上,使用

On iOS and OS X, use arc4random instead. Higher quality randomness, and no need to worry about seeding.

但是,除非您每次都调用srand,否则rand()不应是周期性的.或错误地使用了随机数.

However, rand() shouldn't be noticably periodic, unless you're calling srand each time around. Or using the random numbers incorrectly.