-(NSString *)randomPassword{
//自动生成6位随机密码
NSTimeInterval random=[NSDate timeIntervalSinceReferenceDate];
NSLog(@"now:%.6f",random);
NSString *randomString = [NSString stringWithFormat:@"%.6f",random];
NSString *randompassword =[[randomString componentsSeparatedByString:@"."]objectAtIndex:1];
NSLog(@"randompassword:%@",randompassword);
return randompassword;
}
//也可以直接用
//生成随机6位验证码
-(NSString *)randomPassword{
//自动生成6位随机密码
NSTimeInterval random=[NSDate timeIntervalSinceReferenceDate];
NSLog(@"now:%.6f",random);
NSString *randomString = [NSString stringWithFormat:@"%.6f",random];
NSString *randompassword = [[randomString componentsSeparatedByString:@"."]objectAtIndex:1];
NSLog(@"randompassword:%@",randompassword);
return randompassword;
}