Basics of rand() in C++ & its Application.
Basics of rand() The rand() function in C++ generated a random value in the 'int' acceptable values. This can be used in multiple cases that helps optimize our code for a better result . Let us start by learning the basic syntax and how we can manipulate the rand() function to generate a value which we would prefer to see more often. #include<bits/stdc++.h> using namespace std ; int main () { //syntax of rand () function cout<<rand () <<endl ; //max value of rand () function cout<<RAND_MAX<<endl ; //trends with 'int' data type cout<<INT_MAX<<endl ; ...