For my game I need to have a random selection functioinality for weapons. You pickup a box from the ground, and it searches in the weapon array to return a random weapon struct. To get the random struct from the array, we need the index of it, which must be generated randomly. I am using the srand and rand functions to get a random number, but I want to include criteria.
A rocket launcher should have a lower chance of being selected as the random weapon, while a shotgun a higher chance. How would I go implementing this?