-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoomRandomizer.java
39 lines (36 loc) · 951 Bytes
/
RoomRandomizer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.util.Random;
/**
* La class
* @author Antoine
* @version 08/05/21
*/
public class RoomRandomizer {
private Room[] aTabRandomRoom;
private Random aRandom;
/**
* constructeur naturel
* @param pTabRoom est le tableau complet de toutes les Rooms
*/
public RoomRandomizer(final Room[] pTabRoom)
{
this.aTabRandomRoom = pTabRoom;
this.aRandom = new Random();
}//GenerateRandom()
/**
* determine au hasard une Room
* @param pNbMax est al borne positive max.
* @return une Room aleatoirement, choisis dans le tab
*/
public Room findRandomRoom(final int pNbMax)
{
int vNb = this.aRandom.nextInt(pNbMax); //borne sup en param
return this.aTabRandomRoom[vNb];
}//findRandomRoom(.)
/**
*
*/
public Room determineRoom(final int pNbRoom)
{
return this.aTabRandomRoom[pNbRoom];
}//determineRoom(.)
}