我正在尝试创建一个策划风格的游戏,以建立我的iOS目标c技能.我正在尝试使用以下内容在0到9之间创建6个随机数.我在不同的时间运行时获得不同的数字,但每次运行时所有6个数字始终相同.
NSNumber *n1 = [[NSNumber alloc]initWithInt:(random() % 10)];
NSNumber *n2 = [[NSNumber alloc]initWithInt:(random() % 10)];
NSNumber *n3 = [[NSNumber alloc]initWithInt:(random() % 10)];
NSNumber *n4 = [[NSNumber alloc]initWithInt:(random() % 10)];
NSNumber *n5 = [[NSNumber alloc]initWithInt:(random() % 10)];
NSNumber *n6 = [[NSNumber alloc]initWithInt:(random() % 10)];
Run Code Online (Sandbox Code Playgroud)
任何帮助都会非常有用.