internal GridData Randomize(GridSize gridSize) { var newData = new CellStateEnum[gridSize.NumberRows, gridSize.NumberCols]; var numberCells = gridSize.NumberRows * gridSize.NumberCols; Random randomizer = new Random(); for (int cellPos = 0; cellPos < numberCells; cellPos++) { var rowPos = IncrementEvery(cellPos, gridSize.NumberCols); var colPos = cellPos % gridSize.NumberCols; newData[rowPos, colPos] = GetRandomState(randomizer); } return(new GridData(_iodevice, newData)); }
public Grid WithRandomData(GridSize gridSize) { _data = _data.Randomize(gridSize); return(this); }