I'm trying to create a function that randomly returns a value from a list but remembers the values that have been given before. At the end when the list is empty it should return an empty list. Basically like emptying a bucket full of eggs one at a time.
Suppose I have two lists:
data1 = Range; data2 = Range;
I tried playing with downvalues but that doesn't work.
Calling getRandomItem[data1] two times would give (e.g)
Calling getRandomItem[data2] two times would give (e.g)
At the end as stated before when all items are chosen both
I would like to do that without declaring
data2 as global variables nor do I which to change/alter them.
So, basically I presume the function itself should remember which data has been given to it and where it had left the previous time.