3
Contributors
5
Replies
7
Views
8 Years
Discussion Span
Last Post by csurfer
0

You haven got anything such as int random(int); .

For generation of random numbers you have got the function rand which is of the format int rand(void); .Defined in cstdlib.You will get more information in this <link>.

0

Or a brute force approach would be something like this :

int total;//this holds the number of random numbers to be generated
//Assume you want to generate random numbers between 50 and 70
int cnt=0;//This hold the number of random numbers already generated.
while(cnt<total)
{
//Generate the random number between 1 and 70 say number is rnum
while(rnum<50) 
{
    //generate rnum again
}
cnt++;
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.