From owner-freebsd-bugs@FreeBSD.ORG Thu Jul 31 13:00:37 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E2C6F37B401 for ; Thu, 31 Jul 2003 13:00:37 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 71C3D43FE0 for ; Thu, 31 Jul 2003 13:00:32 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h6VK0WUp007290 for ; Thu, 31 Jul 2003 13:00:32 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h6VK0Wcw007289; Thu, 31 Jul 2003 13:00:32 -0700 (PDT) Date: Thu, 31 Jul 2003 13:00:32 -0700 (PDT) Message-Id: <200307312000.h6VK0Wcw007289@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: "David Brinegar" Subject: Re: bin/54878: incorrect divisor in /usr/bin/jot -r X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: David Brinegar List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2003 20:00:38 -0000 The following reply was made to PR bin/54878; it has been noted by GNATS. From: "David Brinegar" To: "David Schultz - das@freebsd.org" <+jot+brinegar+c45043f3f4.das#freebsd.org@spamgourmet.com> Cc: FreeBSD-gnats-submit@freebsd.org Subject: Re: bin/54878: incorrect divisor in /usr/bin/jot -r Date: Thu, 31 Jul 2003 12:52:36 -0700 David Schultz wrote: > Some people have also invoked jot in ways that anticipate the > correct behavior, too. The manpage author was one of them! The > program appears to be more significantly broken than I originally > thought. Is there a good explanation for the following behavior? I agree with your sentiment. I just don't know how much such corrections would break existing usage or portability. Perhaps the correction should be under a new flag, say -R, so that the -r flag is bug for bug compatible. Explanation of behavior (not necessarily good): The default -w format is %.0f, which prints a rounded floating point value. This cannot produce a uniform random distribution so is probably not suitable for use with -r, as both endpoints of the distribution will only be half as likely as other points. The -r output goes up to but does not include the specified endpoint. jot -r -w %d n 1 4 will not print a 4. jot -r n 1 4 will, as explained above, round [3.5-4.0) to 4 even though 4.0 is not generated before rounding. More explanation at: http://www.freebsd.org/cgi/query-pr.cgi?pr=docs/54879 -- David Brinegar