In this rather basic C++ code snippet involving random number generation:
include using namespace std; int main() { cout << (rand() %
You are not seeding the number.
Use This:
#include #include using namespace std; int main() { srand(static_cast(time(0))); cout << (rand() % 100) << endl; return 0; }
You only need to seed it once though. Basically don't seed it every random number.