You can do percentage selection WAY easier than building an array like that
int GetNumberOfItems() {
const float PercentRoll = FMath::FRand();
int NumberOfItems = 5;
if (PercentRoll <= 0.30f) { NumberOfItems = 3; }
else if (PercentRoll <= 0.70) { NumberOfItems = 4; }
return NumberOfItems;
}
of course, it’ll take a few more lines to make it work with your datatable, but that’s the basics to doing a percent roll for selection.