Du's Time

Du's Time

Code, Thinking or maybe something else

溢出无处不在
# 最近需要做个随机数,一般随机数不都是用时间戳作种子然后生成嘛,于是迅速写下以下代码 1234567//取当前时间NSTimeInterval currentTime = [[NSDate date] timeIntervalSince1970];//将时间戳的精度取到毫秒级,减少种子雷同的概率NSTimeInterval timeStamp = (long)(currentTime * 1000);//srand要求timesrand((unsigned int)timeStamp);NSInteger randomNumber = rand(); 代码愉快地上线之后,居然有1/5...
Du
Hacker, Curious about the world