The code generate and impress the numbers correctely, but they repeat.
Teacher Saiz says:
"For each number you enter, search the vector, the numbers you already have, to find out how many times it appears. This search can be done with foreach, for example. Each time the number is repeated, add 1 to a counter
So it goes in a loop from which it only comes out if the counter is less than 2.
This is what allows you to generate a repeated number just 2x (to form pairs)
All of this will be within a for, to generate 12 numbers"
I followed a teacher diferent path to solve this Issue. I utilized Fisher-Yates Algorithm to shuffle a array pre-defined rather randomize and get head pain in thinking about the "without repeat" question.
The code generate and impress the numbers correctely, but they repeat.
Teacher Saiz says:
"For each number you enter, search the vector, the numbers you already have, to find out how many times it appears. This search can be done with foreach, for example. Each time the number is repeated, add 1 to a counter So it goes in a loop from which it only comes out if the counter is less than 2. This is what allows you to generate a repeated number just 2x (to form pairs) All of this will be within a for, to generate 12 numbers"