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-2008 Andras Varga
00013   Copyright (C) 2006-2008 OpenSim Ltd.
00014 
00015   This file is distributed WITHOUT ANY WARRANTY. See the file
00016   `license' for details on this and other legal matters.
00017 *--------------------------------------------------------------*/
00018 
00019 #ifndef __CRNG_H
00020 #define __CRNG_H
00021 
00022 #include "simkerneldefs.h"
00023 #include "cobject.h"
00024 
00025 NAMESPACE_BEGIN
00026 
00027 class cConfiguration;
00028 
00029 
00051 class SIM_API cRNG : public cObject
00052 {
00053   protected:
00054     unsigned long numDrawn;
00055 
00056   public:
00057     cRNG() {numDrawn=0;}
00058     virtual ~cRNG() {}
00059 
00064     virtual void initialize(int seedSet, int rngId, int numRngs,
00065                             int parsimProcId, int parsimNumPartitions,
00066                             cConfiguration *cfg) = 0;
00067 
00074     virtual void selfTest() = 0;
00075 
00080     virtual unsigned long getNumbersDrawn() const  {return numDrawn;}
00081 
00085     virtual unsigned long intRand() = 0;
00086 
00090     virtual unsigned long intRandMax() = 0;
00091 
00095     virtual unsigned long intRand(unsigned long n) = 0;
00096 
00100     virtual double doubleRand() = 0;
00101 
00105     virtual double doubleRandNonz() = 0;
00106 
00110     virtual double doubleRandIncl1() = 0;
00111 
00115     double doubleRandNonzIncl1() {return 1-doubleRand();}
00116 };
00117 
00118 NAMESPACE_END
00119 
00120 
00121 #endif
00122 
Generated on Tue Dec 2 11:16:27 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3