f you need to generate a random number within your iPhone application, you have to push aside Objective-C, as there is not a class with a method for generating random numbers (as in Java). The alternative is to use C, among the functions available are: rand(), srand(), random(),srandom() and arc4random().
arc4random() tends to be preferred as it does not require seeding, the function automatically
initializes itself.
本文介绍了在iOS应用开发中使用C语言实现随机数生成的方法,包括`arc4random()`函数的使用,以及如何在特定范围内获取随机数。

3589

被折叠的 条评论
为什么被折叠?



