I want to make the group of random numbers 16 elements long for set3.
So the result would be look like this. 0, 1, 0, 2, 1, 1, 1, 0, 2, 2, 1, 1, 0, 0, 2, 0
But, I want to make the result evenly.
For example, digits : the number of digits
0 : 6
1 : 5
2 : 5
not,
0 : 9
1 : 3
2 : 4
srand(time(NULL));
for(int j = 0; j < 16; j++)
{
int num = rand() % 3;
if(j == 15)
cout << num;
else
cout << num << ",";
}
This is my code, any ideas to make those evenly?
Aucun commentaire:
Enregistrer un commentaire