generating random values in iPhone

前端 未结 6 942
Happy的楠姐
Happy的楠姐 2020-12-20 00:18

I have used rand(). But it gives a specific value even after I restart application.

I have implemented following in my application.

- (void)viewDidLo         


        
6条回答
  •  忘掉有多难
    2020-12-20 01:14

    Random number generators in software will actually give PSEUDORANDOM sequences of values.

    Unless you seed the random number generator with a value from a truly random event, you will always get the same sequence each time you use the software.

    I don't know about your software, but it doesn't look like you're seeding the random number generator, Gcamp is probably on the right track.

提交回复
热议问题