We need to add 1, otherwise the maximum generated value will
be end -1. The API is both inclusive.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
uint64_t end)
{
if (state->use64)
- return start + rand64_upto(state, end - start);
+ return start + rand64_upto(state, 1 + end - start);
else
- return start + rand32_upto(state, end - start);
+ return start + rand32_upto(state, 1 + end - start);
}
extern void init_rand(struct frand_state *, bool);