This code should work for 1.9.0 + and will give a random item based on if the random number is greater than 0.5 if its grater than 0.5 again then it goes to the next if statement and so on until its either less than 0.5 or reaches the last item it can give. You can use this on any right-click event for player interaction. So both items and blocks are supported. The last box outside of the procedure should be the component to remove your block or item. If your using a block you don't need to select the type of block to remove, item however, you need to select the gift box item.