+ 1
srand on linux
im trying to use srand in my program to generate a number then promt you to guess the number. i Have srand AND rand in my code. but i keep getting the number 84 can anyone help?????????????????????
2 odpowiedzi
+ 6
Did you use time(0) to randomise the seed?
srand(time(0));
cout << rand() % 100;
// outputs random number from 0 to 99
+ 3
thanks for the reply
i had
int number;
srand(etc here);
but i moved srand on top of my int and it fixed everything for me. thanks for the reply.
i made a little guessing game on my codes. had to go back and fix it xD