True Random Xcode

后端 未结 4 984
耶瑟儿~
耶瑟儿~ 2021-01-26 02:01

I\'m currently making a quiz app. When a user starts the quiz random questions show up like you would expect from a quiz app. The problem is, it is not quite random. It does sho

4条回答
  •  广开言路
    2021-01-26 02:36

    Any random generator is actually pseudorandom. By default it is started from the same initial value. To make it it "real random" you should supply unique start value i.e. "salt" for each run. As a simplest approach you can use [NSDate timeIntervalSinceReferenceDate].

提交回复
热议问题