using System;
using System.Collections.Generic;

namespace skyscraper5.Skyscraper
{
	internal static class RandomExtensions
	{

		public static T NextListItem<T>(this Random rng, List<T> collection, bool discard = false)
		{
			int ptr = rng.Next(collection.Count);
			T result = collection[ptr];
			if (discard)
				collection.RemoveAt(ptr);
			return result;
		}

		public static ushort NextUInt16(this Random rng)
		{
			return (ushort)rng.Next(ushort.MaxValue);
		}
	}
}
