[c++]随机数生成rand()

/ 3评论 / 306阅读 / 0点赞

rand()

在以往的c/c++中生成随机数是使用rand()函数,但它也有一些使用的注意事项

头文件

#include <stdlib.h>

使用

随机数范围

需要srand()初始化种子

#include <time.h>
#include <stdlib.h>

int main() {
    srand(time(nullptr)); //初始化种子
    rand();               //获取随机数
    return 0;
}

多线程时

c++11_random

  1. escanty说道:

    I just lost my baby girl last week at 24 weeks due to a cord accident priligy alternative

  2. embeway说道:

    Shea s, respectively cialis for sale online Different mechanisms related to tamoxifen sensitivity have been widely investigated, including the phosphorylation of ERО±

  3. Coikemn说道:

    David Tuller wrote The FINE results were published in BMJ in April, 2010 buy cialis 5mg online Bartonella infections in HIV infected individuals

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注