您的位置:首页 > 移动开发 > IOS开发

iOS生成最大最小数之间随机数

2014-11-03 20:20 253 查看


Note:Here’s how the above method works.arc4random()
gives you a randominteger between 0 andARC4RANDOM_MAX. If you divide that
number byARC4RANDOM_MAX, you get a float between 0 and 1.

If you multiply this value by the range of values (max–
min), you’ll get a floatbetween 0 and the range. If you add to that themin
value, you’ll get a floatbetweenmin
andmax. Violà, job done! 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐