private void AssignRarity(ShopSlot emptySlot, List <Ingredients_sObj> IngredList) { int shopIndex = UnityEngine.Random.Range(0, IngredList.Count); //INCLUSIVE random among IngredientList if (shopIndex == IngredList.Count) { shopIndex--; //cannot be EQUALS to COUNT, as COUNT13 cannot accept ingredient[13] } Debug.Log("random item is: " + shopIndex); emptySlot.SetIngredient(IngredList[shopIndex]); }