SST  13.0.0
StructuralSimulationToolkit
rng.h
1 // Copyright 2009-2023 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-2023, 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_RNG_H
13 #define SST_CORE_RNG_RNG_H
14 
15 #include <stdint.h>
16 
17 namespace SST {
18 namespace RNG {
19 
20 /**
21  \class Random rng.h "sst/core/rng/rng.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 Random
28 {
29 
30 public:
31  /**
32  Generates the next random number in the range [0,1).
33  */
34  virtual double nextUniform() = 0;
35 
36  /**
37  Generates the next random number as an unsigned 32-bit integer.
38  */
39  virtual uint32_t generateNextUInt32() = 0;
40 
41  /**
42  Generates the next random number as an unsigned 64-bit integer.
43  */
44  virtual uint64_t generateNextUInt64() = 0;
45 
46  /**
47  Generates the next random number as a signed 64-bit integer.
48  */
49  virtual int64_t generateNextInt64() = 0;
50 
51  /**
52  Generates the next random number as a signed 32-bit integer
53  */
54  virtual int32_t generateNextInt32() = 0;
55 
56  /**
57  Destroys the random number generator
58  */
59  virtual ~Random() {}
60 };
61 
62 } // namespace RNG
63 } // namespace SST
64 
65 #endif // SST_CORE_RNG_RNG_H
Implements the base class for random number generators for the SST core.
Definition: rng.h:27
Definition: action.cc:18
virtual int64_t generateNextInt64()=0
Generates the next random number as a signed 64-bit integer.
virtual uint32_t generateNextUInt32()=0
Generates the next random number as an unsigned 32-bit integer.
virtual int32_t generateNextInt32()=0
Generates the next random number as a signed 32-bit integer.
virtual double nextUniform()=0
Generates the next random number in the range [0,1).
virtual ~Random()
Destroys the random number generator.
Definition: rng.h:59
virtual uint64_t generateNextUInt64()=0
Generates the next random number as an unsigned 64-bit integer.