Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对 Objective-C 中的 arc4random() 函数有疑问。
在我在网上看到的示例中,%函数调用之后有一个符号。我认为是%模运算符,那么这个符号在 之后使用时是否还有其他含义arc4random()?它是如何工作的?
%
arc4random()
没有什么特别的意思。arc4random()在(或任何其他随机函数)之后应用模数是限制随机数的最小值/最大值的常见模式。arc4random() % 78例如,将返回一个 0 到 77 之间的数字。
arc4random() % 78