Issue with infinite loop

You could create a local array of type Weapon Perks (within your Get Random Weapon Perk function) with all Perk types, but without the none entry. When you want to select perks, just select a random array element and then get the data table entry associated with that perk type.

If you don’t want repeats, then you can do that as well by removing selected entries from this array, so that it is not available for next random selection.