From 95b7f0209bfefcacf378f5b6c94a4c09ef9202d8 Mon Sep 17 00:00:00 2001 From: bdrewery Date: Tue, 16 Apr 2019 00:41:22 +0000 Subject: [PATCH] Fix 'jot -r 0 start end' to work. This allows an endless stream of random data within the given bounds. It already worked if a seed was provided as the 4th argument but not if one was left out. In collaboration with: jhb MFC after: 2 weeks Relnotes: yes --- usr.bin/jot/jot.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/usr.bin/jot/jot.c b/usr.bin/jot/jot.c index 96d66de11173..23c8e1a24d6c 100644 --- a/usr.bin/jot/jot.c +++ b/usr.bin/jot/jot.c @@ -263,12 +263,15 @@ main(int argc, char **argv) mask = 0; break; case HAVE_REPS | HAVE_BEGIN | HAVE_ENDER: - if (reps == 0) - errx(1, "infinite sequences cannot be bounded"); - else if (reps == 1) - s = 0.0; - else - s = (ender - begin) / (reps - 1); + if (!randomize) { + if (reps == 0) + errx(1, "infinite sequences cannot " + "be bounded"); + else if (reps == 1) + s = 0.0; + else + s = (ender - begin) / (reps - 1); + } mask = 0; break; case HAVE_REPS | HAVE_BEGIN | HAVE_ENDER | HAVE_STEP: