SST  8.0.0
StructuralSimulationToolkit
sstrng.h
1 // Copyright 2009-2018 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2018, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SST_CORE_RNG_SSTRNG_H
13 #define SST_CORE_RNG_SSTRNG_H
14 
15 #include <stdint.h>
16 
17 namespace SST {
18 namespace RNG {
19 
20 /**
21  \class SSTRandom sstrng.h "sst/core/rng/sstrng.h"
22 
23  Implements the base class for random number generators for the SST core. This does not
24  implement an actual RNG itself only the base class which describes the methods each
25  class will implement.
26 */
27 class SSTRandom {
28 
29  public:
30  /**
31  Generates the next random number in the range 0 to 1.
32  */
33  virtual double nextUniform() = 0;
34 
35  /**
36  Generates the next random number as an unsigned 32-bit integer.
37  */
38  virtual uint32_t generateNextUInt32() = 0;
39 
40  /**
41  Generates the next random number as an unsigned 64-bit integer.
42  */
43  virtual uint64_t generateNextUInt64() = 0;
44 
45  /**
46  Generates the next random number as a signed 64-bit integer.
47  */
48  virtual int64_t generateNextInt64() = 0;
49 
50  /**
51  Generates the next random number as a signed 32-bit integer
52  */
53  virtual int32_t generateNextInt32() = 0;
54 
55  /**
56  Destroys the random number generator
57  */
58  virtual ~SSTRandom() { }
59 
60 };
61 
62 } //namespace RNG
63 } //namespace SST
64 
65 #endif //SST_CORE_RNG_SSTRNG_H
virtual int32_t generateNextInt32()=0
Generates the next random number as a signed 32-bit integer.
virtual int64_t generateNextInt64()=0
Generates the next random number as a signed 64-bit integer.
Implements the base class for random number generators for the SST core.
Definition: sstrng.h:27
virtual uint32_t generateNextUInt32()=0
Generates the next random number as an unsigned 32-bit integer.
virtual ~SSTRandom()
Destroys the random number generator.
Definition: sstrng.h:58
virtual uint64_t generateNextUInt64()=0
Generates the next random number as an unsigned 64-bit integer.
virtual double nextUniform()=0
Generates the next random number in the range 0 to 1.