generateRandom

This commit is contained in:
titou 2024-05-26 14:43:41 +02:00
parent d6be7bff9c
commit b378445958
1 changed files with 10 additions and 1 deletions

View File

@ -1,6 +1,8 @@
package backend;
import java.util.ArrayList;
import java.util.Random;
import windowInterface.MyInterface;
public class Simulator extends Thread {
@ -258,6 +260,12 @@ public class Simulator extends Thread {
*/
public void generateRandom(float chanceOfLife) {
//TODO : complete method
Random random = new Random();
for (int y = 0; y<LINE_NUM; y++) {
for (int x = 0; x < COL_NUM; x++) {
field[y][x] = random.nextFloat() < chanceOfLife ? 1 : 0;
}
}
/*
* Advice :
* as you should probably have a separate class
@ -283,7 +291,8 @@ public class Simulator extends Thread {
}
public void toggleClickAction() {
//TODO : complete method
clickActionFlag = !clickActionFlag;
//DONE
}
/**