Re: jot(1) changed behavior

2016-07-16 Thread Jason McIntyre
On Sat, Jul 16, 2016 at 09:46:29PM +0200, Theo Buehler wrote: > I see two options apart from reverting my commit. > > 1. Just fix the bug Otto noticed. Remove the section on randomness >completely and fix one example in the manual. That's what the patch >in this mail does. The patch for jo

Re: jot(1) changed behavior

2016-07-16 Thread Theo Buehler
I see two options apart from reverting my commit. 1. Just fix the bug Otto noticed. Remove the section on randomness completely and fix one example in the manual. That's what the patch in this mail does. The patch for jot.c is the same as in my previous mail. 2. Restore the previous beha

Re: jot(1) changed behavior

2016-07-16 Thread Theo Buehler
This is the second poposal: In addition to fixing the bug Otto noticed, restore the previous behavior when -r is used in combination with -w or -c. This is done by checking whether those flag were specified on the command line. In particular, we have the following situation: $ obj/jot -r 10

Re: jot(1) changed behavior

2016-07-15 Thread Ted Unangst
Philippe Meunier wrote: > jot -r 10 1 3 | sort -n | uniq -c > > which the man page clearly indicates should produce something like: > > 24950 1 > 50038 2 > 25012 3 > > which is also more in line with the "generate random floating point > number and truncate to even" mod

Re: jot(1) changed behavior

2016-07-15 Thread Philippe Meunier
Theo Buehler wrote: >$ jot -r -p 0 10 1 3 | sort -n | uniq -c >33464 1 >33246 2 >33290 3 According to the man page, "in the absence of -p, the precision is the greater of the numbers begin and end". Since both 1 and 3 have a precision of zero, therefore I would expect your command: jot -r -p

Re: jot(1) changed behavior

2016-07-14 Thread Theo Buehler
> The second exmaple: > > $ jot -r -p 0 10 0.5 3.5 | sort -n | uniq -c > 25120 0 > 49882 2 > 24998 4 > > So I'd says there are real bugs introduced with the latest commit. > > -Otto > Indeed, this is bad. The following patch lets the code fall back to the old version in the cases tha

Re: jot(1) changed behavior

2016-07-14 Thread Otto Moerbeek
On Thu, Jul 14, 2016 at 08:42:55PM -0400, Ted Unangst wrote: > Philippe Meunier wrote: > > Looking at the cvs log for jot.c, this seems to be a known change: > > > > "revision 1.27 [...] Internally, jot -r now uses arc4random_uniform() > > whenever this is clearly possible. In particular `jot -r

Re: jot(1) changed behavior

2016-07-14 Thread Ted Unangst
Philippe Meunier wrote: > Looking at the cvs log for jot.c, this seems to be a known change: > > "revision 1.27 [...] Internally, jot -r now uses arc4random_uniform() > whenever this is clearly possible. In particular `jot -r 1 10 20' > yields an unbiased random number between 10 and 20 (both end

Re: jot(1) changed behavior

2016-07-14 Thread Edgar Pettijohn
On 16-07-14 17:55:00, Edgar Pettijohn wrote: > On 16-07-14 12:00:21, Philippe Meunier wrote: > > Hello, > > > > According to jot(1)'s man page: > > > > "$ jot -w %d -r 10 1 4 | sort -n | uniq -c > > 33306 1 > > 33473 2 > > 33221 3 > > > > Note that with random sequences, all numbers generate

Re: jot(1) changed behavior

2016-07-14 Thread Edgar Pettijohn
On 16-07-14 12:00:21, Philippe Meunier wrote: > Hello, > > According to jot(1)'s man page: > > "$ jot -w %d -r 10 1 4 | sort -n | uniq -c > 33306 1 > 33473 2 > 33221 3 > > Note that with random sequences, all numbers generated will be smaller > than the upper bound. The largest value genera