Final fix of User#createPackets
This commit is contained in:
parent
d6d54dbd84
commit
4c2d0ccf50
@ -11,7 +11,7 @@ plugins {
|
||||
}
|
||||
|
||||
run {
|
||||
args = ["10000", "50"]
|
||||
args = ["10000", "17"]
|
||||
}
|
||||
|
||||
application {
|
||||
|
@ -13,6 +13,8 @@ public class User {
|
||||
private int leftForNextSource;
|
||||
private int timeInterval = 1;
|
||||
|
||||
private int mbis;
|
||||
|
||||
private final Random random = new Random();
|
||||
|
||||
public User(double distance, int timeSlotNb, int subCarrierNb) {
|
||||
@ -47,7 +49,9 @@ public class User {
|
||||
if(timeInterval == 0) {
|
||||
timeInterval = random.nextInt(50, 101);
|
||||
// On tire un nombre entre 0 et 2 * m
|
||||
int mbis = random.nextInt(1, 2 * m) + this.leftForNextSource;
|
||||
mbis = random.nextInt(1, 2 * m) + this.leftForNextSource;
|
||||
|
||||
}
|
||||
// On calcule le nombre de paquets qu'on peut transmettre
|
||||
int bitsToSend = random.nextInt(2 * mbis);
|
||||
int nbPacketsToSend = bitsToSend / Packets.packetSize;
|
||||
@ -59,8 +63,6 @@ public class User {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public double getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
Reference in New Issue
Block a user