DeukBot4/DeukBot4/Utilities/IEnumerableExtensions.cs

20 lines
477 B
C#
Raw Normal View History

2018-03-30 14:33:42 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
2018-03-28 23:34:48 +00:00
namespace DeukBot4.Utilities
{
2018-03-30 14:33:42 +00:00
public static class EnumerableExtensions
2018-03-28 23:34:48 +00:00
{
public static string Join(this IEnumerable<string> arr, string sep)
{
return string.Join(sep, arr);
}
2018-03-30 14:33:42 +00:00
public static T Choice<T>(this IEnumerable<T> arr, Random random)
{
var a = arr.ToArray();
return a[random.Next(0, a.Count())];
}
2018-03-28 23:34:48 +00:00
}
}