Generation of arrays that have certain repeat.


With me is a question that am requesting to be answered. Am interesting in making an addition of numbers between 1 and 10 by ensuring that each number is repeated twice in a random indexing. I already did a generation of arrays that had 20 indexes and my focus now is how I can add some values let us say like [ 1237645283936288634838367837338398398338].

How is this made possible?

Last edited on
To ensure that each number is repeated twice, add each number twice. For example: 228855772233998844

To get random indexing, after the numbers are added, shuffle the sequence randomly.
Use std::shuffle
Topic archived. No new replies allowed.