I need to randomly select elements from a list. Currently, I will sometimes select too many copies of an element from the original list eg:
Original List: [0, 1, 2, 3, 4]
3 Randomly Selected Elements: [4, 4, 4]
I do not want multiple 4s selected if there was only 1 in the original list.
What should I do to not take more copies of a value than exists in the first array?