Ajout du code pour le Random
This commit is contained in:
parent
3fec742357
commit
1cb0f39d2d
15
RandomDirection.java
Normal file
15
RandomDirection.java
Normal file
@ -0,0 +1,15 @@
|
||||
import java.util.Random;
|
||||
|
||||
public class RandomDirection {
|
||||
public static final int UP = 0;
|
||||
public static final int DOWN = 1;
|
||||
public static final int LEFT = 2;
|
||||
public static final int RIGHT = 3;
|
||||
|
||||
public static int getRandomDirection() {
|
||||
Random rand = new Random();
|
||||
int direction = rand.nextInt(4);
|
||||
|
||||
return direction;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user