Array Generation with certain repeat

Hello,
I have a small question. I need to assign the values from 1 to 10 by repeating each two times in random index. I generated an array with 20 index. Now, I need to assign the values for example like this:

[3 7 1 6 8 10 5 7 1 9 6 8 10 2 5 4 9 2 4 3]
How can I do this ?
Thank you so much


Last edited on
Put all the values you want in an array and then shuffle them.

https://www.cplusplus.com/reference/algorithm/shuffle/
Last edited on
Thank you so much @lastchance , the problem is solved
Topic archived. No new replies allowed.