X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=lib%2Frand.h;h=089837dbf0267c326dc4b355782558c24080abf1;hb=477bd5ab362b65fe9c7749735236e6ed0d4346f8;hp=02e68585420b942fb7805375308a2f1d77ef91c8;hpb=7d9fb455aadc0c0363489591775496f27f4a560a;p=fio.git diff --git a/lib/rand.h b/lib/rand.h index 02e68585..089837db 100644 --- a/lib/rand.h +++ b/lib/rand.h @@ -1,11 +1,19 @@ #ifndef FIO_RAND_H #define FIO_RAND_H +#define FRAND_MAX (-1U) + struct frand_state { unsigned int s1, s2, s3; }; -extern struct frand_state __fio_rand_state; +static inline void frand_copy(struct frand_state *dst, + struct frand_state *src) +{ + dst->s1 = src->s1; + dst->s2 = src->s2; + dst->s3 = src->s3; +} static inline unsigned int __rand(struct frand_state *state) { @@ -19,7 +27,11 @@ static inline unsigned int __rand(struct frand_state *state) } extern void init_rand(struct frand_state *); +extern void init_rand_seed(struct frand_state *, unsigned int seed); extern void __fill_random_buf(void *buf, unsigned int len, unsigned long seed); -extern unsigned long fill_random_buf(void *buf, unsigned int len); +extern unsigned long fill_random_buf(struct frand_state *, void *buf, unsigned int len); +extern void __fill_random_buf_percentage(unsigned long, void *, unsigned int, unsigned int, unsigned int, char *, unsigned int); +extern unsigned long fill_random_buf_percentage(struct frand_state *, void *, unsigned int, unsigned int, unsigned int, char *, unsigned int); +extern void fill_pattern(void *p, unsigned int len, char *pattern, unsigned int pattern_bytes); #endif