List of random numbers - arc4random

前端 未结 2 1069
春和景丽
春和景丽 2021-01-27 17:52

I want to create an array of numbers from 0-9 and want them to be randomized

Meaning, when a user clicks on a UIButton it creates an NSMutableArray of objects 4,5,8,3,6,

2条回答
  •  既然无缘
    2021-01-27 18:27

    As per this SO answer whats-the-best-way-to-shuffle-an-nsmutablearray, just create your list of numbers 0..9, (or 0..1000, whatever) in a mutable array and then randomly shuffle them.

提交回复
热议问题