better random

This commit is contained in:
marc barbier
2020-12-16 17:58:10 +01:00
parent 611c9f8d29
commit 98baa2229a
2 changed files with 4 additions and 1 deletions
Binary file not shown.
+4 -1
View File
@@ -1,17 +1,20 @@
package game; package game;
import java.io.IOException; import java.io.IOException;
import java.util.Random;
public class Match extends Thread { public class Match extends Thread {
Joueur joueur1, joueur2; Joueur joueur1, joueur2;
int tour = 1; int tour = 1;
private Board board; private Board board;
private Random rand;
public Match(ComsJoueur joueur1Com, ComsJoueur joueur2Com) throws IOException { public Match(ComsJoueur joueur1Com, ComsJoueur joueur2Com) throws IOException {
super(); super();
this.board=new Board(); this.board=new Board();
// random j2/j1 // random j2/j1
if (Math.random() > 0.5F) { rand = new Random();
if (rand.nextBoolean()) {
joueur1 = new Joueur(joueur1Com); joueur1 = new Joueur(joueur1Com);
joueur2 = new Joueur(joueur2Com); joueur2 = new Joueur(joueur2Com);
} else { } else {