crng.h

00001 //==========================================================================
00002 //   CRNG.H  - part of
00003 //                     OMNeT++/OMNEST
00004 //            Discrete System Simulation in C++
00005 //
00006 //
00007 //  cRNG: interface for random number generator classes
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 __CRNG_H
00019 #define __CRNG_H
00020 
00021 #include "defs.h"
00022 #include "cpolymorphic.h"
00023 
00024 class cConfiguration;
00025 
00026 
00048 class SIM_API cRNG : public cPolymorphic
00049 {
00050   protected:
00051     unsigned long numDrawn;
00052 
00053   public:
00054     cRNG() {numDrawn=0;}
00055     virtual ~cRNG() {}
00056 
00061     virtual void initialize(int runNumber, int rngId, int numRngs,
00062                             int parsimProcId, int parsimNumPartitions,
00063                             cConfiguration *cfg) = 0;
00064 
00071     virtual void selfTest() = 0;
00072 
00077     virtual unsigned long numbersDrawn() {return numDrawn;}
00078 
00082     virtual unsigned long intRand() = 0;
00083 
00087     virtual unsigned long intRandMax() = 0;
00088 
00092     virtual unsigned long intRand(unsigned long n) = 0;
00093 
00097     virtual double doubleRand() = 0;
00098 
00102     virtual double doubleRandNonz() = 0;
00103 
00107     virtual double doubleRandIncl1() = 0;
00108 
00112     double doubleRandNonzIncl1() {return 1-doubleRand();}
00113 };
00114 
00115 #endif
00116 

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