Question: 6. Random numbers with demos 6.1 int rand(void): returns a pseudo-random number in the range of 0 to RAND MAX O. RAND MAX is a

 6. Random numbers with demos 6.1 int rand(void): returns a pseudo-random
number in the range of 0 to RAND MAX O. RAND MAX

6. Random numbers with demos 6.1 int rand(void): returns a pseudo-random number in the range of 0 to RAND MAX O. RAND MAX is a constant defined by the implementation. 6.2 void srand(unsigned seed ): Seeds the pseudo-random number generator used by rand with the value seed. Usually, a parameter, time(0), is used for srando. time() returns a time t value which vary every time and hence the pseudo-random number vary for every program call. Examplel: 1 #include 2 #include 3 using namespace std; 4 int main 5 6 7 for(int i = 0; i 2 #include 4 using namespace std; 5 int main() 6 7 8 srand(unsigned)time(0)); for(int i = 0; i 2 #include 4 using namespace std; 5 int main) 6 7 8 9 10 ) srand((unsigned)time(0)); for(int index=0; index 2 #include 3 using namespace std; 4 int main 5 6 7 for(int i = 0; i 2 #include 4 using namespace std; 5 int main() 6 7 8 srand(unsigned)time(0)); for(int i = 0; i 2 #include 4 using namespace std; 5 int main) 6 7 8 9 10 ) srand((unsigned)time(0)); for(int index=0; index

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!