HomeFreeBSD

random(6): Fix off-by-one

Description

random(6): Fix off-by-one

After r355693, random(6) -f sometimes fail to output all the lines of the
input file. This is because the range from which random indices are chosen
is too big, so occasionally the random selection doesn't correspond to any
line and nothing gets printed.

(Ed. note: Mea culpa. Working on r355693, I was confused by the sometime
use of 1-indexing, sometimes 0-indexing in randomize_fd().)

Submitted by: Ryan Moeller <ryan AT freqlabs.com>
X-MFC-With: r355693
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D23199

Details

Provenance
cemAuthored on
Differential Revision
D23199: random(6): Fix off-by-one error
Parents
rS356809: setextattr: Increase stdin buffer size to 4096
Branches
Unknown
Tags
Unknown