/// <summary> /// Returns random item from enumerable /// </summary> /// <param name="enumerable">The enumerable</param> /// <typeparam name="T">The type</typeparam> /// <returns>Random item</returns> public static T RandomItem <T>([NotNull] this IEnumerable <T> enumerable) { var collection = enumerable is ICollection <T> coll ? coll : enumerable.ToList(); return(collection.Count == 0 ? default : collection.ElementAt(RadUtilities.RandomInt(0, collection.Count))); }
internal static void Initialize() { try { RadUtilities.Initialize(false); } catch { Console.WriteLine("Failed to initialize RadLibrary"); } }