SST  14.0.0
StructuralSimulationToolkit
rng.h
1 // Copyright 2009-2024 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-2024, 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 "sst/core/serialization/serializable.h"
16 
17 #include <stdint.h>
18 
19 namespace SST {
20 namespace RNG {
21 
22 /**
23  \class Random rng.h "sst/core/rng/rng.h"
24 
25  Implements the base class for random number generators for the SST core. This does not
26  implement an actual RNG itself only the base class which describes the methods each
27  class will implement.
28 */
30 {
31 
32 public:
33  /**
34  Generates the next random number in the range [0,1).
35  */
36  virtual double nextUniform() = 0;
37 
38  /**
39  Generates the next random number as an unsigned 32-bit integer.
40  */
41  virtual uint32_t generateNextUInt32() = 0;
42 
43  /**
44  Generates the next random number as an unsigned 64-bit integer.
45  */
46  virtual uint64_t generateNextUInt64() = 0;
47 
48  /**
49  Generates the next random number as a signed 64-bit integer.
50  */
51  virtual int64_t generateNextInt64() = 0;
52 
53  /**
54  Generates the next random number as a signed 32-bit integer
55  */
56  virtual int32_t generateNextInt32() = 0;
57 
58  /**
59  Destroys the random number generator
60  */
61  virtual ~Random() {}
62 
63  virtual void serialize_order(SST::Core::Serialization::serializer& UNUSED(ser)) override {};
64  ImplementVirtualSerializable(SST::RNG::Random)
65 };
66 
67 } // namespace RNG
68 } // namespace SST
69 
70 #endif // SST_CORE_RNG_RNG_H
Implements the base class for random number generators for the SST core.
Definition: rng.h:29
This class is basically a wrapper for objects to declare the order in which their members should be s...
Definition: serializer.h:35
Definition: action.cc:18
Definition: serializable.h:118
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:61
virtual uint64_t generateNextUInt64()=0
Generates the next random number as an unsigned 64-bit integer.