Loop through TArray of a struct

UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Utils")
void RandomArrayItem(const TArray<FInventoryItem>& InputArray, int32& OutputIndex, FInventoryItem& OutputItem);

void AMyPlayerController::RandomArrayItem_Implementation(const TArray<FInventoryItem> 
 &InputArray, int32 &OutputIndex, FInventoryItem &OutputItem)
{
   const int32 SizeOfArray = InputArray.Num();

   if (SizeOfArray == 0) { return; }

   OutputIndex = FMath::RandRange(0, SizeOfArray - 1);
   OutputItem = InputArray[OutputIndex];
}

Here is a small example using your code of getting a random item from that array.