Help with rand()

closed account (38qG1hU5)
I set this up(its an example)

a = rand() %4;

cout << "" << a;


everytime I do this I get 1 and if I do
a = rand() %100
I get 41!!!!
Help!!!!!
Insert this when starting the code:

srand();


And if you want your randomness to be a better one, include the library

#include <ctime>


and insert this instead:

srand(time(0));
Topic archived. No new replies allowed.