我收到警告生成srandom(时间(NULL))

时间:2017-05-09 16:29:22

标签: ios objective-c

@implementation ViewController

- (void) viewDidLoad{
    [super viewDidLoad];

    srandom (time(NULL)); // **warning! implicit conversion loses integer precision: 'time_t' (aka 'long') 'to unsigned int' **

    _number= random() % 100 +1;

    NSLog(@"random number is %d",_number);
}

0 个答案:

没有答案