From: Jens Axboe Date: Thu, 25 Mar 2010 22:31:50 +0000 (+0100) Subject: Only use true random generator for initial seed X-Git-Tag: fio-1.39-rc1~15 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=d77431b5975096bfd9aafb431c0aa656c9ae8fa8;ds=sidebyside Only use true random generator for initial seed Than hokus pokus the rest. End result is still OK random, and it doesn't compress (which is the real test here). Signed-off-by: Jens Axboe --- diff --git a/io_u.c b/io_u.c index 3558a073..23037f1a 100644 --- a/io_u.c +++ b/io_u.c @@ -1217,14 +1217,16 @@ void io_u_fill_buffer(struct thread_data *td, struct io_u *io_u, long *ptr = io_u->buf; if (!td->o.zero_buffers) { - while ((void *) ptr - io_u->buf < max_bs) { - unsigned int r = __rand(&__fio_rand_state); + unsigned long r = __rand(&__fio_rand_state); - if (sizeof(r) != sizeof(*ptr)) - r *= GOLDEN_RATIO_PRIME; + if (sizeof(int) != sizeof(*ptr)) + r *= (unsigned long) __rand(&__fio_rand_state); + while ((void *) ptr - io_u->buf < max_bs) { *ptr = r; ptr++; + r *= GOLDEN_RATIO_PRIME; + r >>= 3; } } else memset(ptr, 0, max_bs);