vendredi 21 septembre 2018

How do i Pick a Random Number from an array in c++? [on hold]

int array[5];
int Random;
for (int i = 0; i <5; i++)
{
    cin>>array[i];
}
for (int j = 0; j < 5; j++)
{
    Random = array[rand() % array[j]];
}
cout << Random << endl;

This is giving me continously return 1 but i want different number every time




Aucun commentaire:

Enregistrer un commentaire