Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

laprej

macrumors regular
Original poster
Oct 14, 2005
108
2
Troy, NY
I have two Cocoa apps that simulate the DSR wireless routing protocol - one is baseline DSR and the other is a variation that I'm attempting to write. Here's the catch: when I run the simulators in one directory, I get one set of results. When I run it from another directory, I get different results. Any idea why? I pass the seed in to the random number generator on the command-line. Example:

Code:
guardian:Release$ ./RPE 1218741914 100 20
2008-08-14 20:24:09.311 RPE[5108:10b] GC = (null)
2008-08-14 20:24:09.313 RPE[5108:10b] seedVal = 1218741914
2008-08-14 20:24:09.313 RPE[5108:10b] Node 0 placed at (109.909233, 145.675049)
...
2008-08-14 20:24:22.656 RPE[5108:10b] The sink received 15071 packets.

Running it again, this time from the parent directory containing the Release directory:
Code:
guardian:build$ ./Release/RPE 1218741914 100 20
2008-08-14 20:27:20.902 RPE[5117:10b] GC = (null)
2008-08-14 20:27:20.904 RPE[5117:10b] seedVal = 1218741914
2008-08-14 20:27:20.905 RPE[5117:10b] Node 0 placed at (109.909233, 145.675049)
...
2008-08-14 20:27:38.271 RPE[5117:10b] The sink received 17479 packets.

Does anyone have any idea of what is going on? The seeds are the same, and the node placement is randomly generated so considering node 0 is at the same location for both runs, I'd say that part is working correctly. Outside of that, does anyone have any ideas? Also, running it from the same directory gives the same answer. I am very confused :(
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.