--- shuf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shuf.c b/shuf.c index 36b3898..21210de 100644 --- a/shuf.c +++ b/shuf.c @@ -47,11 +47,11 @@ main(int argc, char *argv[]) } } - random_seed(); + rng32_seed(); if (!rflag) { for (i = buf.nlines - 1; i > 0; i--) { - j = random_uniform(i+1); + j = rng32_bounded(i+1); line = buf.lines[j]; buf.lines[j] = buf.lines[i]; buf.lines[i] = line; @@ -63,7 +63,7 @@ main(int argc, char *argv[]) } } else { for (;;) { - j = random_uniform(buf.nlines); + j = rng32_bounded(buf.nlines); line = buf.lines[j]; fwrite(line.data, 1, line.len, stdout); } -- 2.44.0
- [hackers] [sbase][PATCH] Add implementation of shuf(1) Elie Le Vaillant
- [hackers] [sbase][PATCH] libutil: add random.c Elie Le Vaillant
- [hackers] [sbase][PATCH] shuf: use libutil/rando... Elie Le Vaillant
- [hackers] [sbase][PATCH] libutil/random: rewrite... Elie Le Vaillant
- [hackers] [sbase][PATCH] shuf: use new libut... Elie Le Vaillant
- [hackers] [sbase][PATCH] cron: use new libut... Elie Le Vaillant
- [hackers] [sbase][PATCH] libutil/random:... Elie Le Vaillant
- [hackers] [sbase][PATCH] libutil/ra... Elie Le Vaillant
- [hackers] [sbase][PATCH] libuti... Elie Le Vaillant
- Re: [hackers] [sbase][PATCH] libuti... Steve Ward
- Re: [hackers] [sbase][PATCH] libuti... NRK
- [hackers] [sbase][PATCH] cron: fix repea... Elie Le Vaillant
- [hackers] [sbase][PATCH] Add implementation of shuf(... Elie Le Vaillant