From owner-freebsd-doc@FreeBSD.ORG Fri Jul 25 23:30:11 2003 Return-Path: Delivered-To: freebsd-doc@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 835E037B404 for ; Fri, 25 Jul 2003 23:30:11 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D205E43FB1 for ; Fri, 25 Jul 2003 23:30:09 -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 h6Q6U9Up072630 for ; Fri, 25 Jul 2003 23:30:09 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h6Q6U9s7072629; Fri, 25 Jul 2003 23:30:09 -0700 (PDT) Resent-Date: Fri, 25 Jul 2003 23:30:09 -0700 (PDT) Resent-Message-Id: <200307260630.h6Q6U9s7072629@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-doc@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "David Brinegar" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CDEC237B401 for ; Fri, 25 Jul 2003 23:28:36 -0700 (PDT) Received: from brinegar-computing.com (adsl-64-170-154-150.dsl.sntc01.pacbell.net [64.170.154.150]) by mx1.FreeBSD.org (Postfix) with SMTP id 2900043F3F for ; Fri, 25 Jul 2003 23:28:36 -0700 (PDT) (envelope-from manjot.3.brinegar@spamgourmet.com) Received: (qmail 5348 invoked by uid 1000); 26 Jul 2003 06:28:35 -0000 Message-Id: <20030726062835.5347.qmail@brinegar-computing.com> Date: 26 Jul 2003 06:28:35 -0000 From: "David Brinegar" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: docs/54879: man 1 jot, -r description X-BeenThere: freebsd-doc@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Documentation project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jul 2003 06:30:11 -0000 >Number: 54879 >Category: docs >Synopsis: man 1 jot, -r description >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-doc >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Fri Jul 25 23:30:09 PDT 2003 >Closed-Date: >Last-Modified: >Originator: David Brinegar >Release: FreeBSD 4.6-RELEASE i386 >Organization: >Environment: Any Freebsd machine. >Description: Two inaccurate statements and missing information about defaults. "Random numbers are obtained through random(3)." is no longer true. "while 20 random 8-letter strings are produced with jot -r -c 160 a z | rs -g 0 8" cannot produce the letter z. And there is no mention of the default -w %.0f format which creates an unexpected distribution due to rounding. >How-To-Repeat: man 1 jot To see the affect of rounding: > jot -r 1000 1 4 | sort -n | uniq -c 169 1 <= top and bottom are half as likely as the others 344 2 319 3 168 4 <= Internally, jot is assigning random floating point values like so: [1.0, 1.5) => 1 [1.5, 2.5] => 2 (2.5, 3.5) => 3 [3.5, 4.0) => 4 which just follows from the way printf rounds "%.0f". > jot -w %d -r 1000 1 4 | sort -n | uniq -c 335 1 <= uniform distribution, but no 4 338 2 327 3 Here internally jot is flooring the same floating point values instead of rounding them. >Fix: "Random numbers are obtained through arc4random(3)." "while 20 random 8-letter strings are produced with jot -r -c 160 a { | rs -g 0 8 Note: { comes after z (see man 7 ascii.) Note: jot -r -c 0 a z cannot produce a z character. And some hint about the default -w format and how "%.0f" skews the distribution would be useful. >Release-Note: >Audit-Trail: >Unformatted: