From 39e9eb74c011ee5351ac1796e5df529a70aa8945 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Mon, 26 May 2008 23:08:31 +0000 Subject: new option: "sim.message.prob.mean" new brainstorm. --- sources/core/VSProcess.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sources/core/VSProcess.java') diff --git a/sources/core/VSProcess.java b/sources/core/VSProcess.java index 03b980f..1a7f319 100644 --- a/sources/core/VSProcess.java +++ b/sources/core/VSProcess.java @@ -584,9 +584,11 @@ public class VSProcess extends VSPrefs { * * @return the a random message outage time */ - public synchronized long getARandomMessageOutageTime(final long durationTime) { + public synchronized long getARandomMessageOutageTime(final long durationTime, VSProcess receiverProcess) { + int percentage = (int) ((getInteger("message.prob.outage") + + receiverProcess.getInteger("message.prob.outage")) / 2); /* Check if the message will have an outage or not */ - if (random.nextInt(100) < getInteger("message.prob.outage")) { + if (getRandomPercentage() <= percentage) { /* Calculate the random outage time! */ final long outageTime = globalTime + random.nextLong(durationTime+1) % simulationCanvas.getUntilTime(); return outageTime; -- cgit v1.2.3