You can assign the items from the array to instance variables on the chest, it's up to you how you want to do it. You could fill an array with random items and assign 1,0 to item1 and 2,0 to item 2 on the chest and generate the items again for each chest, or you could do it another way which is to have an array which contains every item in the game and set item1, item2 etc on the chest to a random item from the array. In the end it just depends how your game works and how the items in the chest are determined, but pretty much you are assigning a random item to a variable on the chest.