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

/ 1,903评论 / 10869阅读 / 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. RandallGuesE说道:

    buy cytotec over the counter: buy cytotec pills – buy cytotec in usa

  2. WilliamRen说道:

    https://lisinopril.network/# 25 mg lisinopril

  3. Davidfrify说道:

    tamoxifen moa nolvadex 10mg tamoxifen alternatives

发表回复

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