iOS Random Numbers in a range

∥☆過路亽.° 提交于 2019-12-01 12:33:33

(arc4random() % 100) + 200

tpun11

Not to be picky, but I am pretty sure you have to add a number... if you want all the numbers from 200 to and including 300... use

200 + arc4random()%101; 

arc4random()%100 would give a random number from 0 to 99 so 300 would never occur...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!