A permutation is one of several possible ways in which you can order or arrange a group of things. Write a program that displays a new random permutation of the integers 0 to 9 at the request of its user. For example, the program’s output could be as follows:
2 8 0 1 9 3 5 4 6 7
Another permutation? yes
6 5 3 1 0 9 7 4 2 8
Another permutation? no
Bye!
Use a list to contain your permutation. Each time you generate a random integer between 0 and 9, check to see whether the integer is in the list. If it is, generate another random integer. If it is not, add it to the list. Continue this process until the list contains ten integers.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here