If I don't specify srand(), what seed does rand() use?

前端 未结 5 1530
借酒劲吻你
借酒劲吻你 2020-12-11 18:44

Here is the code:

#include 
#include 
#include 

int main(void)
{
    int r;
    int i;
    for (i = 0; i < 1         


        
5条回答
  •  抹茶落季
    2020-12-11 19:12

    If srand is not called, rand acts as if srand(1) has been called.

    http://www.acm.uiuc.edu/webmonkeys/book/c_guide/2.13.html#rand

提交回复
热议问题