Merge branch 'master' of gitlab.istic.univ-rennes1.fr:18008147/ntr
This commit is contained in:
commit
74bcba2de3
@ -33,6 +33,8 @@ public class AccessPoint {
|
|||||||
*/
|
*/
|
||||||
private final double min, max;
|
private final double min, max;
|
||||||
|
|
||||||
|
private Random random = new Random();
|
||||||
|
|
||||||
|
|
||||||
public AccessPoint(Scheduler scheduler, ResourceBlock[][] frame, List<User> users, int timeSlotNb, int subCarrierNb, double min, double max) {
|
public AccessPoint(Scheduler scheduler, ResourceBlock[][] frame, List<User> users, int timeSlotNb, int subCarrierNb, double min, double max) {
|
||||||
this.min = min;
|
this.min = min;
|
||||||
@ -65,7 +67,6 @@ public class AccessPoint {
|
|||||||
|
|
||||||
private void updateBandwidth(int ticks) {
|
private void updateBandwidth(int ticks) {
|
||||||
int n = 200;
|
int n = 200;
|
||||||
Random random = new Random();
|
|
||||||
int timeInterval = 50 + random.nextInt(51);
|
int timeInterval = 50 + random.nextInt(51);
|
||||||
for(User user : users) {
|
for(User user : users) {
|
||||||
// On régénère le tableau de débits toutes les 50 ms
|
// On régénère le tableau de débits toutes les 50 ms
|
||||||
|
@ -12,6 +12,8 @@ public class User {
|
|||||||
private final List<Packets> packetsSent;
|
private final List<Packets> packetsSent;
|
||||||
private int leftForNextSource;
|
private int leftForNextSource;
|
||||||
|
|
||||||
|
private Random random = new Random();
|
||||||
|
|
||||||
public User(double distance, int timeSlotNb, int subCarrierNb) {
|
public User(double distance, int timeSlotNb, int subCarrierNb) {
|
||||||
this.distance = distance;
|
this.distance = distance;
|
||||||
this.bandwidthTable = new double[timeSlotNb][subCarrierNb];
|
this.bandwidthTable = new double[timeSlotNb][subCarrierNb];
|
||||||
@ -21,7 +23,7 @@ public class User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void generateBandwidth() {
|
public void generateBandwidth() {
|
||||||
double random = Math.random();
|
double random = this.random.nextDouble();
|
||||||
for(int i = 0; i < bandwidthTable.length; i++) {
|
for(int i = 0; i < bandwidthTable.length; i++) {
|
||||||
for(int j = 0; j < bandwidthTable[i].length; j++) {
|
for(int j = 0; j < bandwidthTable[i].length; j++) {
|
||||||
double h = 1 * Math.sqrt(-2 * Math.log(1 - random));
|
double h = 1 * Math.sqrt(-2 * Math.log(1 - random));
|
||||||
|
Reference in New Issue
Block a user