srand()函数

上一篇 / 下一篇  2008-01-03 15:20:36 / 个人分类:学习.net 使用编程100例

srand()函数:Sets a random starting point

The srand function sets the starting point for generating a series of pseudorandom integers. To reinitialize the generator, use 1 as the seed argument. Any other value for seed sets the generator to a random starting point. rand retrieves the pseudorandom numbers that are generated. Calling rand before any call to srand generates the same sequence as calling srand with seed passed as 1.

附加:在程序用时要加C的库函数 #include <stdlib.h>。否则会出现 “找不到标识符”。


TAG:

 

评分:0

我来说两句

Open Toolbar