Question

C++ Program that produces ten random permutations of the numbers 1 to 10

Write a program that produces ten random permutations of the numbers 1 to 10. To generate a random permutation, you need to fill a vector with the numbers 1 to 10 sothat no two entries of the vector have the same contents. You could do it by brute force, by calling rand_int until it produces a value that is not yet in the vector.Instead, you should implement a smart method.
Make a second array and fill it with the numbers 1 to 10. Then pick one of those at random, remove it, and append it to the permutation vector.
Repeat ten times.

Solutions

Expert Solution
No answers


Submit Your Answer