is there a similar function in c where I can bind variables to random numbers?
local xoffset, yoffset, zoffset = math.random(-1, 10), math.random(1, -10), math.random(1, 10)
CodePudding user response:
There is a full suite of random number generation algoriths in <random>
. You can do something like this:
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);
...