@Override
 public long getJitter(
     long cleanMsgPropagationDelay,
     NetMessage msg,
     ModularNetLayer nlSender,
     ModularNetLayer nlReceiver,
     NetMeasurementDB db) {
   return Math.round(rand.nextDouble() * max);
 }
 public boolean performModification(TreeNode node) {
   int nodeCount = node.getChildren().size();
   for (TreeNode child : node.getChildren()) {
     double oldWeight = child.getWeight();
     double newWeight = oldWeight + generator.nextGaussian() / (8 * nodeCount);
     child.setWeight(newWeight);
   }
   counter++;
   if (counter >= 50) {
     counter = 0;
     return false;
   } else {
     return true;
   }
 }
示例#3
0
 /**
  * This method sets the seed of the global random generator which can be obtained using the static
  * getRandom()-method.
  *
  * @param seed the seed to configure the global random generator
  */
 public void setSeed(long seed) {
   checkRunning();
   this.seed = seed;
   randomGen.setSeed(seed);
 }
示例#4
0
 public int roll(RandomGenerator randomGenerator) {
   return randomGenerator.nextInt(redNums.length + blackNums.length + 2);
 }