OMNeT++ Simulation Library  5.6.1
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 
49 class SIM_API cRNG : public cObject
50 {
51  protected:
52  unsigned long numDrawn;
53 
54  public:
55  cRNG() {numDrawn=0;}
56  virtual ~cRNG() {}
57 
62  virtual void initialize(int seedSet, int rngId, int numRngs,
63  int parsimProcId, int parsimNumPartitions,
64  cConfiguration *cfg) = 0;
65 
72  virtual void selfTest() = 0;
73 
78  virtual unsigned long getNumbersDrawn() const {return numDrawn;}
79 
83  virtual unsigned long intRand() = 0;
84 
88  virtual unsigned long intRandMax() = 0;
89 
93  virtual unsigned long intRand(unsigned long n) = 0;
94 
98  virtual double doubleRand() = 0;
99 
103  virtual double doubleRandNonz() = 0;
104 
108  virtual double doubleRandIncl1() = 0;
109 
113  double doubleRandNonzIncl1() {return 1-doubleRand();}
114 };
115 
116 } // namespace omnetpp
117 
118 
119 #endif
120 
Root of the OMNeT++ class hierarchy. cObject is a lightweight class without any data members...
Definition: cobject.h:58
Abstract interface for random number generator classes.
Definition: crng.h:49
double doubleRandNonzIncl1()
Definition: crng.h:113
virtual unsigned long getNumbersDrawn() const
Definition: crng.h:78
Definition: cabstracthistogram.h:21
Represents the configuration, as accessed by the simulation kernel.
Definition: cconfiguration.h:70