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.

14th Jan 2017, 6:42 PM
gyana nayak
gyana nayak - avatar
2 odpowiedzi
+ 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
14th Jan 2017, 7:58 PM
Robert McC
Robert McC - avatar
+ 1
you can use srand with time add: #include <time.h> srand(time(0)); srand will be seeded with deferrent values every time
14th Jan 2017, 9:04 PM
A M ~ Smart !
A M ~ Smart ! - avatar