1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-29 15:58:33 +01:00

removed the array-based GetRandomEntry method as it made lists have to be typecast

This commit is contained in:
Ell 2021-03-04 22:53:39 +01:00
parent 1c8b738555
commit 053aaaf17c

View file

@ -15,11 +15,6 @@ namespace MLEM.Extensions {
/// <param name="entries">The entries to choose from</param> /// <param name="entries">The entries to choose from</param>
/// <typeparam name="T">The entries' type</typeparam> /// <typeparam name="T">The entries' type</typeparam>
/// <returns>A random entry</returns> /// <returns>A random entry</returns>
public static T GetRandomEntry<T>(this Random random, params T[] entries) {
return entries[random.Next(entries.Length)];
}
/// <inheritdoc cref="GetRandomEntry{T}(System.Random,T[])"/>
public static T GetRandomEntry<T>(this Random random, IList<T> entries) { public static T GetRandomEntry<T>(this Random random, IList<T> entries) {
return entries[random.Next(entries.Count)]; return entries[random.Next(entries.Count)];
} }