xref: /kvm-unit-tests/lib/rand.h (revision 6b801c8981f74d75419d77e031dd37f5ad356efe)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * (pseudo) random functions
4  *
5  * Copyright IBM Corp. 2024
6  */
7 #ifndef _RAND_H_
8 #define _RAND_H_
9 
10 #include <stdint.h>
11 
12 /* Non cryptographically secure PRNG */
13 typedef struct {
14 	uint32_t hash[8];
15 	uint8_t next_word;
16 } prng_state;
17 prng_state prng_init(uint64_t seed);
18 uint32_t prng32(prng_state *state);
19 uint64_t prng64(prng_state *state);
20 
21 #endif /* _RAND_H_ */
22