Make random choice | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Make random choice

I'm trying to make that my c++ program choses randomly between 2 possible Outputs,can someone help me plese

11th Dec 2019, 12:04 AM
Daniel Vetter
Daniel Vetter - avatar
1 Answer
0
#include <random> #include <ctime> srand(time(0)); x = 1+rand()%2; // random between 1 and 2
11th Dec 2019, 1:51 AM
Элеонора Сергеева
Элеонора Сергеева - avatar