Supermarket.Supermarket.RandomProduct C# (CSharp) Method

RandomProduct() public method

Gets a random product with a random quantity from the supermarket catalogue
public RandomProduct ( ) : Product
return Product
        public Product RandomProduct()
        {
            // Random product
            int index = Random.Range(0, catalogue.Count);
            Product product = catalogue.ElementAt(index).Value;
            Product productToGive = product.Split();                // New instance, same stats

            // Random quantity
            productToGive.Quantity = Random.Range(1, 50);
            return productToGive;
        }