using System; using System.Linq; using System.Text; using System.Collections.Generic; public class Test { public static void Main() { // your code goes here IEnumerable resultNums = Enumerable.Range(1, 45).Shuffle().Take(5).OrderBy(n => n); StringBuilder sb = new StringBuilder(); foreach (int num in resultNums) { sb.Append(num + " "); } Console.WriteLine(sb); } } public static class EnumerableExtension { public static IEnumerable Shuffle(this IEnumerable collection) { System.Random random = new System.Random(); return collection.OrderBy(node => random.Next()); } }