Created
November 18, 2021 10:36
-
-
Save RubenNL/0083c4bea7978a2d49b9087b3b0f5340 to your computer and use it in GitHub Desktop.
Revisions
-
RubenNL created this gist
Nov 18, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ using System; using System.Collections.Generic; using System.Linq; namespace GUI { public class Bag { private readonly Random _random; private Queue<Matrix> _bag = new(); //using queue for easy pop/dequeue. public Bag(int seed) { _random = new Random(seed); } private void Fill() { _bag = new Queue<Matrix>(Matrix.GetMatrixes().OrderBy(_ => _random.Next())); } public Matrix GetNextMatrix() { if (_bag.Count == 0) Fill(); return _bag.Dequeue(); } } }