lua math.random 等价于 C++?

the lua math.random equivalent for c ++?

在c++中有没有类似的函数可以将变量绑定到随机数?

local xoffset, yoffset, zoffset = math.random(-1, 10), math.random(1, -10), math.random(1, 10)

<random>中有一整套随机数生成算法。你可以这样做:

    std::default_random_engine e1(r());
    int xoffset = std::uniform_int_distribution<int>{-1, 10}(e1);
    int yoffset = std::uniform_int_distribution<int>{-10, 1}(e1);
    ...