+ 2
Why the following code produce different random numbers even thoug it has no seeding process? Shouldn`t the output be always 41?
for (x=0;x<10;x++) { cout << rand()<<endl; }
3 Réponses
+ 6
no. it will always produce the same 'set' of numbers. it is the same as if you had set a seed and are using the same number everytime
+ 3
What jay said
For a true random value look at this code
https://code.sololearn.com/ce1uCi9fvZ7b/?ref=app