using System;

namespace Quadarax.Foundation.Core.Value
{
    public static  class Enumeration
    {
        private static readonly Random _random = new Random();
        public static TEnumValue GetRandom<TEnumValue>() where TEnumValue : Enum
        {
            var values = Enum.GetValues(typeof(TEnumValue));
            var result = values.GetValue(_random.Next(values.Length));
            if (result is null)
                return default!;
            return (TEnumValue)result;

        }
    }
}
