Checking list of properties for values

I’ve never toyed around with lists before, mostly doing things through abominably clumsy code in the past, but I figure this would probably be much quicker if I knew where to look for it.

My goal is this: an item has six properties, each of which are checked to display a number going from one to six. I intend these values to be randomly reshuffled quite constantly, but never repeating in a single set. That is, only one property should have a 1, only one should be 2 and so on, although the order of the sequence would change all the time. A number like 123456 or 536421 should be possible, but not 221335.

What I would need to do is a way to assign randomly selected values to each property, while also making sure that each value has not been assigned before. My first instinct would have been to simply do a random roll for the first value, then do another roll for the second, check if the first had that value assigned and loop until I got an unused value, and then go on like that, but that would turn into a mess by the fourth or so. An easier way would be if I could check if the result of the role has been already assigned to any one of a list of properties.

The short of it would be: how can I check a list of properties to see if any of said properties have been assigned a certain value? Assuming an item like this:

``````numberDisplay: Thing
firstNumber = nil
secondNumber = nil
thirdNumber = nil``````

How can I assign a value to each going from 1 to 3 so as to get numbers like 231 or 123 while making sure I never get something like 223 or 111?

You could use the ShuffledIntegerList subclass of ShuffledList to populate your properties (or possibly to replace them entirely).