Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace SimpleIEnumerable
- {
- class Program
- {
- static void Main(string[] args)
- {
- foreach (var random in RandomNum(10, 10)) Console.WriteLine(random);
- Console.ReadLine();
- }
- static Random rnd = new Random();
- static IEnumerable<int> RandomNum(int max, int count)
- {
- for (int i = 0; i < count; i++) yield return rnd.Next(max);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement