experiments/csharp/E059-RandomTypes/Program.cs

12 lines
233 B
C#
Raw Normal View History

2024-05-04 21:16:52 +01:00
foreach (int number in Get10RandomNumbers())
{
Console.WriteLine(number);
}
static IEnumerable<int> Get10RandomNumbers()
{
var random = new Random();
for (var i = 0; i < 10; i++)
yield return random.Next();
}