[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ns] problem when running nam



On Tue, 5 Jun 2001, Shuju Wu wrote:

> It's in the all-in-one package, in both 2.1b6 
> and 2.1b7 this happens now. But a year ago, 
> I used 2.1b6, there was no this problem.
> (all on Solaris). Someone please, help me.

Any changes in version(s) of Solaris? Of your compiler?
My best guess is that you're doing mobility simulations,
and that in nam:

[~nam]$ grep random\(\) *.cc
anetmodel.cc:	    ((Random::random()&0xffff)/32768.0 - 1.0);
anetmodel.cc:	    ((Random::random()&0xffff)/32768.0 - 1.0);
random.cc:random() GCC_THROW
random.cc:	printf("random() called in ns.\nRandom is not portable,
please use Random::uniform() instead.\n");

is causing your problem. (That error message needs fixing to
indicate whether ns or nam...)

In ns there's still:

mobilenode.cc:	dX_ = (double) Random::random();
mobilenode.cc:	dY_ = (double) Random::random();

which is odd after all, Random::uniform() returns a double anyway, and
I've never even heard of uniform_positive_int().

        static int random() { return rng()->uniform_positive_int(); }
        static double uniform() { return rng()->uniform_double();}

Code says:

void
MobileNode::random_direction()
{
 /* this code isn't used anymore -dam 1/22/98 */

so why is it there?

Edit, recompile, report how you get on.

L.

> > > Can anyone help me with this?
> > > after I generate out.nam file and ran NAM, 
> > > an error message said:
> > > 
> > > random() called in ns.
> > > Random is not portable, please use Random::uniform() instead.
> > > Abort

<[email protected]>PGP<http://www.ee.surrey.ac.uk/Personal/L.Wood/>