0
#include <iostream. #include <cstdlib> using namespace std; int main () { srand(98); for (int x = 1; x <= 10; x++) {
can some tell me how srand(98) effect the output random numbers.
2 Réponses
+ 2
srand seeds the random number generator to start at the same initialisation point so the sequence of random numbers should be the same if srand is set
+ 1
you can use srand with time
add:
#include <time.h>
srand(time(0));
srand will be seeded with deferrent values every time