Changeset d9585291 for libcfa/src
- Timestamp:
- Dec 28, 2022, 12:50:50 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 8d9d974, a7662b8
- Parents:
- 8ee54963
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/random.hfa
r8ee54963 rd9585291 10 10 // Created On : Fri Jan 14 07:18:11 2022 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 14 20:32:53202213 // Update Count : 17 712 // Last Modified On : Thu Dec 22 20:54:22 2022 13 // Update Count : 178 14 14 // 15 15 16 16 #pragma once 17 17 18 #include <stdint.h> 18 #include <stdint.h> // uintXX_t 19 19 20 20 #define GLUE2( x, y ) x##y … … 194 194 static inline uint64_t lehmer64( __uint128_t & state ) { 195 195 __uint128_t ret = state; 196 state *= 0x da942042e4dd58b5;196 state *= 0x_da94_2042_e4dd_58b5; 197 197 return ret >> 64; 198 198 } // lehmer64 199 199 200 200 static inline void lehmer64_set_seed( __uint128_t & state, uint64_t seed ) { 201 // The seed needs to be coprime with the 2^64 modulus to get the argest period, so no factors of 2 in the seed.201 // The seed needs to be coprime with the 2^64 modulus to get the largest period, so no factors of 2 in the seed. 202 202 state = seed; 203 203 lehmer64( state ); // prime
Note: See TracChangeset
for help on using the changeset viewer.