Generating random numbers in Objective-C

前端 未结 13 2562
孤街浪徒
孤街浪徒 2020-11-22 02:07

I\'m a Java head mainly, and I want a way to generate a pseudo-random number between 0 and 74. In Java I would use the method:

Random.nextInt(74)
         


        
13条回答
  •  忘掉有多难
    2020-11-22 02:20

    There are some great, articulate answers already, but the question asks for a random number between 0 and 74. Use:

    arc4random_uniform(75)

提交回复
热议问题