📜  1 到百随机数 CPP - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:45.539000             🧑  作者: Mango

代码示例1
#include 
#include 
int main()
{
    std::random_device rd; // obtain a random number from hardware
    std::mt19937 gen(rd()); // seed the generator
    std::uniform_int_distribution<> distr(25, 63); // define the range

    for(int n=0; n<40; ++n)
        std::cout << distr(gen) << ' '; // generate numbers
}