Task: I need an algorithm that would make a list of numbers that are unique, yet fall within a certain range of numbers. No number can be duplicated in this list.
Example: Given a range of numbers from 1 to 100, pick 20 numbers in this range at random, and store them in a list or array. None of the 20 numbers selected can occur more than once in this list/array.
Variables will be:
1) The quantity of unique numbers needed (e.g. 20 in the above example)
2) The range of numbers (e.g, 1-100)
If the algorithm is run twice, it should not produce the same results.
Can anyone provide such an algorithm?