mardi 18 juillet 2017

Need to generate random #'s from 100 to 500

For my class assignment I have to generate 120 random numbers ranging from 100-500. This is the code that I am using how

void create_random_numbers(int ran[], int x) 
{
    unsigned seed = time(0);

    srand(seed);
    int random_integer;
    for (int index = 0; index<400; index++)
    {

    //  cout << random_integer << endl<<endl;
        ran[index] =  (rand()%500)+100;

        cout << ran[index] << endl << endl;
    }

}




Aucun commentaire:

Enregistrer un commentaire