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