mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-06-23 21:30:05 +02:00
16 lines
429 B
C#
16 lines
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)];
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|