RandomCommand Class Reference

Inheritance diagram for RandomCommand:

TclCommand Collaboration diagram for RandomCommand:

Collaboration graph
[legend]

Detailed Description

Definition at line 136 of file misc.cc.

Public Member Functions

virtual int command (int argc, const char *const *argv)
 RandomCommand ()


Constructor & Destructor Documentation

RandomCommand::RandomCommand  )  [inline]
 

Definition at line 138 of file misc.cc.

00138 : TclCommand("ns-random") { }


Member Function Documentation

int RandomCommand::command int  argc,
const char *const *  argv
[virtual]
 

Definition at line 146 of file misc.cc.

References Random::random(), Random::seed(), and Random::seed_heuristically().

00147 {
00148     Tcl& tcl = Tcl::instance();
00149     if (argc == 1) {
00150         sprintf(tcl.buffer(), "%u", Random::random());
00151         tcl.result(tcl.buffer());
00152     } else if (argc == 2) {
00153         int seed = atoi(argv[1]);
00154         if (seed == 0)
00155             seed = Random::seed_heuristically();
00156         else
00157             Random::seed(seed);
00158         tcl.resultf("%d", seed);
00159     }
00160     return (TCL_OK);
00161 }

Here is the call graph for this function:


The documentation for this class was generated from the following file:
Generated on Tue Mar 6 17:26:42 2007 for ns2 Network Simulator 2.29 by  doxygen 1.4.6