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
This commit is contained in:
parent
92c71535ca
commit
95b7f0209b
@ -263,12 +263,15 @@ main(int argc, char **argv)
|
|||||||
mask = 0;
|
mask = 0;
|
||||||
break;
|
break;
|
||||||
case HAVE_REPS | HAVE_BEGIN | HAVE_ENDER:
|
case HAVE_REPS | HAVE_BEGIN | HAVE_ENDER:
|
||||||
if (reps == 0)
|
if (!randomize) {
|
||||||
errx(1, "infinite sequences cannot be bounded");
|
if (reps == 0)
|
||||||
else if (reps == 1)
|
errx(1, "infinite sequences cannot "
|
||||||
s = 0.0;
|
"be bounded");
|
||||||
else
|
else if (reps == 1)
|
||||||
s = (ender - begin) / (reps - 1);
|
s = 0.0;
|
||||||
|
else
|
||||||
|
s = (ender - begin) / (reps - 1);
|
||||||
|
}
|
||||||
mask = 0;
|
mask = 0;
|
||||||
break;
|
break;
|
||||||
case HAVE_REPS | HAVE_BEGIN | HAVE_ENDER | HAVE_STEP:
|
case HAVE_REPS | HAVE_BEGIN | HAVE_ENDER | HAVE_STEP:
|
||||||
|
Loading…
Reference in New Issue
Block a user