I would like all the number up to an upperbound to be chosen randomly with each number from 1 to upper bound only appearing once. For example if i have the number 5. I would like all the numbers from 1 to 5 be printed to an array but randomly, such as [5,2,3,1,4].
I would do this with a double for loop and check if my random number generator gives a number that is already chosen, if not I would store the value into the array. This seems like a really inefficient method, is there a better way to do this?