99问答网
所有问题
谁可以帮我详细的解释一下c语言里函数rand()和srand()的用法
新手不太明白.通俗点的.
举报该问题
推荐答案 推荐于2016-11-11
srand是用来设置随机时间的种子,一般与rand()结合使用。否则直接用rand()的话,每次运行程序的结果都相同。
原型:int srand (unsigned int seed);
srand((unsigned) time(&t));此句的参数使用time()函数获得系统时间作为种子,并且把获得的时间强制转换为unsigned。
温馨提示:答案为网友推荐,仅供参考
当前网址:
http://99.wendadaohang.com/zd/zzBWWeOz.html
相似回答
大家正在搜
相关问题
c语言中rand()函数与srand()函数有什么区别呢
求教C语言中rand()和srand()具体用法的区别?另外...
关于C语言中rand函数和srand函数的用法
C语言srand和rand函数
srand函数和rand函数到底如何使用??
c语言,大神解答下rand和srand函数的用法和其头函数。...
C语言中srand随机函数怎么用?
c语言中rand()函数怎么用?