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

ns-2.0 under Solaris - random fix



Hi,

We're building ns 2.0 10-Sep-97 under Solaris 2.4.

lines 368-370 of chost.cc read:

	case RANDOM: 
	{
		int foo = int(random() * nActive_ + 1);


Solaris 2.4 is SVR4, and you've catered for this in random.h
with 

#if defined(__svr4__) || defined(__SVR4)
                return (::lrand48() & 0x7fffffff);
#else
                return (::random());
#endif


since we don't have random() [and don't miss it since it was never
particularly random...]

So, in chost.cc, you really need to say something like:

        case RANDOM:
        {
                int foo = int(Random::uniform() * nActive_ + 1);


(I think it should be uniform here - can you confirm?)

This is the only example of non-SVR4 random() breaking on SVR4 that
we've found; looks like one got missed in tidying-up.

Cheers,

L.

<[email protected]>PGP<http://www.sat-net.com/L.Wood/>+44-1483-300800x3641