I want to have the random numbers between 1 to 5 for a variable of 5arrays. for having the random numbers i am using the code as below.
The problem with this way of generating random number is that i get the same set of random numbers in every outputs. Is there any other way to have different random numbers with many different outcomes as much as possible.Code:for(int i=1;i<=5;i++) { int j=rand()%5; cout<<j<<endl; }




Reply With Quote