1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-16 18:53:12 +01:00
MLEM/MLEM/Extensions/RandomExtensions.cs
2019-08-06 14:20:11 +02:00

16 lines
No EOL
429 B
C#

using System;
using System.Collections.Generic;
namespace MLEM.Extensions {
public static class RandomExtensions {
public static T GetRandomEntry<T>(this Random random, params T[] entries) {
return entries[random.Next(entries.Length)];
}
public static T GetRandomEntry<T>(this Random random, IList<T> entries) {
return entries[random.Next(entries.Count)];
}
}
}