+ 1
how does a rand() works?
#include <iostream> #include <cstdlib> using namespace std; int main() { for (int x = 1; x <= 10; x++) { cout << rand() << endl; } } every time how it's output can be same?
2 Respostas
+ 6
See it does produce random values but they are same at each execution
If u want different values at each execution use srand();