From f3719657559213f65350da7bb76af060333f2f86 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Fri, 15 Jan 2010 14:00:06 +0000 Subject: [PATCH] bugfix: generated random seeds were not reloaded correctly --- tools/cooja/java/se/sics/cooja/Simulation.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/Simulation.java b/tools/cooja/java/se/sics/cooja/Simulation.java index 9704cdb8c..bc0ebef36 100644 --- a/tools/cooja/java/se/sics/cooja/Simulation.java +++ b/tools/cooja/java/se/sics/cooja/Simulation.java @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: Simulation.java,v 1.56 2009/11/27 15:53:10 fros4943 Exp $ + * $Id: Simulation.java,v 1.57 2010/01/15 14:00:06 fros4943 Exp $ */ package se.sics.cooja; @@ -528,14 +528,19 @@ public class Simulation extends Observable implements Runnable { // Random seed if (element.getName().equals("randomseed")) { - if (manualRandomSeed != null) { - setRandomSeed(manualRandomSeed); - } else if (element.getText().equals("generated")) { + long newSeed; + + if (element.getText().equals("generated")) { randomSeedGenerated = true; - setRandomSeed(new Random().nextLong()); + newSeed = new Random().nextLong(); } else { - setRandomSeed(Long.parseLong(element.getText())); + newSeed = Long.parseLong(element.getText()); } + if (manualRandomSeed != null) { + newSeed = manualRandomSeed; + } + + setRandomSeed(newSeed); } // Max mote startup delay