X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=lib%2Frand.h;h=a806004504013bc41986b6d1b6dbd6f6067b0a91;hb=ae5c7cdd710dfa97705d965dcf001a96504e5f31;hp=46c1c5e023a132513ded05d885bd5769dbf7ceb9;hpb=f0ed01ed095cf1ca7c1945a5a0267e8f73b7b4a9;p=fio.git diff --git a/lib/rand.h b/lib/rand.h index 46c1c5e0..a8060045 100644 --- a/lib/rand.h +++ b/lib/rand.h @@ -150,6 +150,16 @@ static inline uint64_t rand_between(struct frand_state *state, uint64_t start, return start + rand32_upto(state, end - start); } +static inline uint64_t __get_next_seed(struct frand_state *fs) +{ + uint64_t r = __rand(fs); + + if (sizeof(int) != sizeof(long *)) + r *= (unsigned long) __rand(fs); + + return r; +} + extern void init_rand(struct frand_state *, bool); extern void init_rand_seed(struct frand_state *, uint64_t seed, bool); extern void __fill_random_buf(void *buf, unsigned int len, uint64_t seed);