imate
C++/CUDA Reference
xoshiro_256_star_star.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_XOSHIRO_256_STAR_STAR_H_
13 #define _RANDOM_GENERATOR_XOSHIRO_256_STAR_STAR_H_
14 
15 
16 // =======
17 // Headers
18 // =======
19 
20 #include <stdint.h> // int64_t, uint64_t, UINT64_C
21 
22 
23 // =====================
24 // Xoshiro 256 Star Star
25 // =====================
26 
48 
50 {
51  public:
52  explicit Xoshiro256StarStar(const int64_t seed);
54  uint64_t next();
55  void jump();
56  void long_jump();
57 
58  protected:
59  static inline uint64_t rotation_left(
60  const uint64_t x,
61  int k);
62 
63  // Member data
64  uint64_t *state;
65 };
66 
67 
68 #endif // _RANDOM_GENERATOR_XOSHIRO_256_STAR_STAR_H_
Pseudo-random integer generator. This class generates 64-bit integer using Xoshiro256** algorithm.
Xoshiro256StarStar(const int64_t seed)
Constructor. It initializes the state variable with random integers using splitmix64 pseudo-random ge...
static uint64_t rotation_left(const uint64_t x, int k)
Rotates the bits of a 64 bit integer toward left.
void long_jump()
Long jump function for the generator. It is equivalent to 2^192 calls to next(). It can be used to ge...
uint64_t next()
Generates the next presudo-random number.
void jump()
Jump function for the generator. It is equivalent to 2^128 calls to next(); it can be used to generat...