Added 33. Dice (csharp)

This commit is contained in:
James Curran
2021-02-19 20:18:47 -05:00
parent dd7f2eb672
commit e6ae4828b6
7 changed files with 217 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
namespace BasicComputerGames.Dice
{
public class RollGenerator
{
static Random _rnd = new Random();
public static void ReseedRNG(int seed) => _rnd = new Random(seed);
public IEnumerable<(int die1, int die2)> Rolls()
{
while (true)
{
yield return (_rnd.Next(1, 7), _rnd.Next(1, 7));
}
}
}
}