From 05541007569ce4d7a25b64a0726e9ab4e7952124 Mon Sep 17 00:00:00 2001 From: arthur <c19222814> Date: Tue, 6 Oct 2020 20:37:41 +0200 Subject: [PATCH] =?UTF-8?q?impl=C3=A9mentation=20de=20la=20m=C3=A9thode=20?= =?UTF-8?q?randomGeneration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Grid.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Grid.java b/Grid.java index 7972a9b..19f447f 100644 --- a/Grid.java +++ b/Grid.java @@ -163,6 +163,12 @@ public class Grid implements Iterable<Cell> { */ void randomGeneration(Random random) { + GridIterator iterator = new GridIterator(this); + while (iterator.hasNext()) { + if (random.nextBoolean()) + iterator.next().setAlive(); + else + iterator.next().setDead(); + } } - } -- GitLab