re: How do you do random? VIEW POST

FULL DISCUSSION
 

Modern C++

std::default_random_engine engine;
engine.seed((unsigned)time(0));

std::uniform_int_distribution<int> rand(0, 10);

int random_number = rand(engine);

C

srand((unsigned)time(0));
rand() % 11;
code of conduct - report abuse