Merge branch 'master' of gitlab.istic.univ-rennes1.fr:18008147/ntr

This commit is contained in:
Remi Boure 2023-03-17 11:41:09 +01:00
commit 74bcba2de3
2 changed files with 5 additions and 2 deletions

View File

@ -33,6 +33,8 @@ public class AccessPoint {
*/
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) {
this.min = min;
@ -65,7 +67,6 @@ public class AccessPoint {
private void updateBandwidth(int ticks) {
int n = 200;
Random random = new Random();
int timeInterval = 50 + random.nextInt(51);
for(User user : users) {
// On régénère le tableau de débits toutes les 50 ms

View File

@ -12,6 +12,8 @@ public class User {
private final List<Packets> packetsSent;
private int leftForNextSource;
private Random random = new Random();
public User(double distance, int timeSlotNb, int subCarrierNb) {
this.distance = distance;
this.bandwidthTable = new double[timeSlotNb][subCarrierNb];
@ -21,7 +23,7 @@ public class User {
}
public void generateBandwidth() {
double random = Math.random();
double random = this.random.nextDouble();
for(int i = 0; i < bandwidthTable.length; i++) {
for(int j = 0; j < bandwidthTable[i].length; j++) {
double h = 1 * Math.sqrt(-2 * Math.log(1 - random));