imate
C++/CUDA Reference
split_mix_64.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright 2021, Siavash Ameli <sameli@berkeley.edu>
3  * SPDX-License-Identifier: BSD-3-Clause
4  * SPDX-FileType: SOURCE
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the license found in the LICENSE.txt file in the root
8  * directory of this source tree.
9  */
10 
11 
12 #ifndef _RANDOM_GENERATOR_SPLIT_MIX_64_H_
13 #define _RANDOM_GENERATOR_SPLIT_MIX_64_H_
14 
15 
16 // ======
17 // Header
18 // ======
19 
20 #include <stdint.h> // int64_t, uint64_t
21 
22 
23 // ============
24 // Split Mix 64
25 // ============
26 
41 
43 {
44  public:
45  explicit SplitMix64(const int64_t seed_);
46  uint64_t next();
47 
48  protected:
49  uint64_t state;
50 };
51 
52 #endif // _RANDOM_GENERATOR_SPLIT_MIX_64_H_
Pseudo-random integer generator. This class generates 64-bit integer using SplitMix64 algorithm.
Definition: split_mix_64.h:43
uint64_t state
Definition: split_mix_64.h:49
uint64_t next()
Generates the next presudo-random number in the sequence.
SplitMix64(const int64_t seed_)
Constructor. Initializes the state with current time.