protected bool HasItemDroppedOut(int id) { if (!DisplayedCounter.ContainsKey(id)) // the first hit { return(false); } else // the second and other hits { double dropProbability = DropProbability(id); bool hasItemDroppedOut = random.NextDouble() < dropProbability; return(hasItemDroppedOut); } }
protected void IncrementDisplayedCount(IEnumerable <Item> displayItems) { foreach (Item item in displayItems) { if (DisplayedCounter.ContainsKey(item.Id)) { DisplayedCounter[item.Id]++; } else { DisplayedCounter.Add(item.Id, 1); } } }