Dear all, I have 2 questions: first: how to insert a delay in our c++ code that could affect a nodes sending time(I mean delaying in nodes sending time)? I have used sleep() function from c++ which doesn't work and my program hangs when ever I use it.
second: In my c++ code I have written a piece of code which is used for random number generation: srand((unsigned)time(0)); float random = ((rand()%100000)) ; random = float(float(random) / 10000.0) ; if(random > 5.0) random = random / 2; it seams that ns2 generates the same value for all of my nodes, which possibly mean that ns2 doesn't care about our scheduling and processes all the c++ code all at once. any answers or hints will be highly appreciated.
