該樓層疑似違規已被系統折疊 隐藏此樓檢視此樓
C99:TC3
7.20.2 Pseudo-random sequence generation functions
7.20.2.1 The rand function
Synopsis
1 #include
int rand(void);
Description
2 The rand function computes a sequence of pseudo-random integers in the range 0 to RAND_MAX.
3 The implementation shall behave as if no library function calls the rand function.
Returns
4 The rand function returns a pseudo-random integer.
Environmental limits
5 The value of the RAND_MAX macro shall be at least 32767.
7.20.2.2 The srand function
Synopsis
1 #include
void srand(unsigned int seed);
Description
2 The srand function uses the argument as a seed for a new sequence of pseudo-random
numbers to be returned by subsequent calls to rand. If srand is then called with the
same seed value, the sequence of pseudo-random numbers shall be repeated. If rand is
called before any calls to srand have been made, the same sequence shall be generated
as when srand is first called with a seed value of 1.
3 The implementation shall behave as if no library function calls the srand function.
Returns
4 The srand function returns no value.