random.h

00001 //==========================================================================
00002 //  RANDOM.H - part of
00003 //                     OMNeT++/OMNEST
00004 //            Discrete System Simulation in C++
00005 //
00006 //
00007 //  Random number generator functions
00008 //
00009 //==========================================================================
00010 
00011 /*--------------------------------------------------------------*
00012   Copyright (C) 1992-2005 Andras Varga
00013 
00014   This file is distributed WITHOUT ANY WARRANTY. See the file
00015   `license' for details on this and other legal matters.
00016 *--------------------------------------------------------------*/
00017 
00018 #ifndef __RANDOM_H
00019 #define __RANDOM_H
00020 
00021 #include "defs.h"
00022 #include "csimul.h"
00023 #include "cmodule.h"
00024 #include "crng.h"
00025 
00026 
00027 // helper: return the "current" RNG.
00028 inline cRNG *__contextModuleRNG(int k) {
00029     return simulation.contextModule() ? simulation.contextModule()->rng(k) : ev.rng(k);
00030 }
00031 
00038 
00042 inline long intrand(long r)  {return __contextModuleRNG(0)->intRand(r);}
00043 
00047 inline double dblrand()  {return __contextModuleRNG(0)->doubleRand();}
00048 
00052 inline long genk_intrand(int k,long r)  {return __contextModuleRNG(k)->intRand(r);}
00053 
00057 inline double genk_dblrand(int k)  {return __contextModuleRNG(k)->doubleRand();}
00059 
00060 #endif
00061 
00062 

Generated on Sat Oct 21 17:47:56 2006 for OMNeT++/OMNEST Simulation Library by  doxygen 1.4.6