Branch data Line data Source code
1 : : // Copyright 2019-2024 David Robillard <d@drobilla.net> 2 : : // SPDX-License-Identifier: ISC 3 : : 4 : : #ifndef EXESS_TEST_INT_TEST_UTILS_H 5 : : #define EXESS_TEST_INT_TEST_UTILS_H 6 : : 7 : : #include <stdint.h> 8 : : 9 : : /// Linear Congruential Generator for making random 32-bit integers 10 : : static inline uint32_t 11 : 79488 : lcg32(const uint32_t i) 12 : : { 13 : : static const uint32_t a = 134775813U; 14 : : static const uint32_t c = 1U; 15 : : 16 : 79488 : return (a * i) + c; 17 : : } 18 : : 19 : : /// Linear Congruential Generator for making random 64-bit integers 20 : : static inline uint64_t 21 : 12288 : lcg64(const uint64_t i) 22 : : { 23 : : static const uint64_t a = 6364136223846793005ULL; 24 : : static const uint64_t c = 1ULL; 25 : : 26 : 12288 : return (a * i) + c; 27 : : } 28 : : 29 : : #endif // EXESS_TEST_INT_TEST_UTILS_H