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

Who calls random()?



Dear ns users;

I described my problem on installing the ns and nam in

    http://www-mash.cs.berkeley.edu/dist/archive/ns-users/9908/0130.html

but I could not get any suggestions.
Then I tried to install piece by piece instead of all-in-one.
I installed all of them successfully. But when I ran nam I got an error message
"Random is not portable, please use Random::uniform() instead.", again and
nam didn't start.
This message was displayed by the function random() in random.cc. So I edited
random.cc as below.

random()
{
        printf("random() called in ns.\nRandom is not portable, please use Random::uniform() instead.\n");
        return 1;
        /*abort();*/
}

After I recompiled, I could start nam without aborting.
It is great that I can enjoy nam, finally!!
But whenever I start nam, I got a lot of (more than 100) error messages same as above;
"Random is not portable, please use Random::uniform() instead."
After getting these messages, I can play nam freely without getting any error messages.
But this modification that I did is not a smart solution, and I am wondering if
this probrem can trouble me in the future.

I used grep command to look for "random()" under the directory "nam-1.0a7" and
could find these 3 files including "random()".

nam-1.0a7/random.cc
nam-1.0a7/config.h
nam-1.0a7/rng.h

But in these 3 files, I couldn't find any random() which calls
the function "random()" in random.cc.

So what I am asking is,
-Why random() is called so many times when I start nam?
-WHO calls random() ?

Does anybody have any idea?


In Makefile under the directory "nam-1.0a7", there are these lines as below;
                TCL2C = ../tclcl-1.0b8/tcl2c++
this and this macro seems to be used for translating tcl-formatted library into C++
object-file-formatted files.
I doubt that when nam starts, nam inputs these many library files and runs
them for setting up. And in these library files there are many random()
which should call random() in the standard libraly of C++ but they call random()
in random.cc somehow.
These tcl library files are already object-file-formatted, so I could not find
with grep.
This is only my guess, but if this is true I would like to edit source code
for tcl libraly files and compile all of them again so that I will never get any
error message.

Does anybody have any idea for my trougle?
Any suggestions would be deeply apreciated.

Thanks in advance for your help.

Mikihiro Ueno