I have an items array called items. I have already assigned variables to the array, but I need a function that randomly selects from the array and adds it to another array called inventory. I also need to make sure it only picks variables that are not already in inventory.
Try doing this: -
#incluse<cstdlib> at the top and then
inventory[rand() % inventory.length] to get a random element from the
Please let me know if it works.