using System.Collections.Generic; namespace HeuristicLab.Problems.ProgramSynthesis.Push.Extensions { using HeuristicLab.Core; using HeuristicLab.Random; public static class CollectionExtensions { public static T Random(this IReadOnlyList source, IRandom random = null) { random = random ?? new MersenneTwister(); var x = random.Next(source.Count); return source[x]; } } }