OMNeT++ Simulation Library  6.0.3
crng.h
1 //==========================================================================
2 // CRNG.H - part of
3 // OMNeT++/OMNEST
4 // Discrete System Simulation in C++
5 //
6 //==========================================================================
7 
8 /*--------------------------------------------------------------*
9  Copyright (C) 1992-2017 Andras Varga
10  Copyright (C) 2006-2017 OpenSim Ltd.
11 
12  This file is distributed WITHOUT ANY WARRANTY. See the file
13  `license' for details on this and other legal matters.
14 *--------------------------------------------------------------*/
15 
16 #ifndef __OMNETPP_CRNG_H
17 #define __OMNETPP_CRNG_H
18 
19 #include "simkerneldefs.h"
20 #include "cobject.h"
21 
22 namespace omnetpp {
23 
24 class cConfiguration;
25 
26 
48 class SIM_API cRNG : public cObject
49 {
50  protected:
51  uint64_t numDrawn = 0;
52 
53  public:
54  cRNG() {}
55  virtual ~cRNG() {}
56 
61  virtual void initialize(int seedSet, int rngId, int numRngs,
62  int parsimProcId, int parsimNumPartitions,
63  cConfiguration *cfg) = 0;
64 
71  virtual void selfTest() = 0;
72 
77  virtual uint64_t getNumbersDrawn() const {return numDrawn;}
78 
82  virtual uint32_t intRand() = 0;
83 
87  virtual uint32_t intRandMax() = 0;
88 
92  virtual uint32_t intRand(uint32_t n) = 0;
93 
97  virtual double doubleRand() = 0;
98 
102  virtual double doubleRandNonz() = 0;
103 
107  virtual double doubleRandIncl1() = 0;
108 
112  double doubleRandNonzIncl1() {return 1-doubleRand();}
113 };
114 
115 } // namespace omnetpp
116 
117 
118 #endif
119 
omnetpp::cObject
cObject is a lightweight class which serves as the root of the OMNeT++ class hierarchy....
Definition: cobject.h:92
omnetpp::cRNG::getNumbersDrawn
virtual uint64_t getNumbersDrawn() const
Definition: crng.h:77
omnetpp::cConfiguration
Represents the configuration, as accessed by the simulation kernel.
Definition: cconfiguration.h:76
omnetpp::cRNG
Abstract interface for random number generator classes.
Definition: crng.h:48
omnetpp::cRNG::doubleRandNonzIncl1
double doubleRandNonzIncl1()
Definition: crng.h:112