Evolution/Evolution/Utils/RandomChooser.cs
/// <summary>
/// Returns an infinite enumerable where elements where randomly chosen from a list
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="list">The list.</param>
/// <returns></returns>
Returns an infinite enumerable where elements where randomly chosen from a list
Returns an infinite enumerable where elements where randomly chosen from a list
public static IEnumerable<T> ToRandomEnumerable<T>(this IList<T> list)
        {
            RandomGenerator rnd = RandomGenerator.GetInstance();
            while (true)
            {
                yield return list[rnd.NextInt(list.Count)];
            }
        }
public static IEnumerable < T > ToRandomEnumerable < T > ( this IList < T > list ) { RandomGenerator rnd = RandomGenerator . GetInstance ( ) ; while ( true ) { yield return list [ rnd . NextInt ( list . Count ) ] ; } }
Returns an infinite enumerable where elements where randomly chosen from a list
Returns an infinite enumerable where elements where randomly chosen from a list
None
IList<T>
this
list
None
typeparam
None