From manjot.3.brinegar@spamgourmet.com  Fri Jul 25 23:28:36 2003
Return-Path: <manjot.3.brinegar@spamgourmet.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id CDEC237B401
	for <FreeBSD-gnats-submit@freebsd.org>; 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 <FreeBSD-gnats-submit@freebsd.org>; 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" <manjot.3.brinegar@spamgourmet.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: man 1 jot, -r description 
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         54879
>Category:       docs
>Synopsis:       jot(1) -r description
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dds
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 25 23:30:09 PDT 2003
>Closed-Date:    Mon Nov 27 09:05:45 GMT 2006
>Last-Modified:  Mon Nov 27 09:05:45 GMT 2006
>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:
Responsible-Changed-From-To: freebsd-doc->dds 
Responsible-Changed-By: dds 
Responsible-Changed-When: Mon Nov 6 10:30:54 UTC 2006 
Responsible-Changed-Why:  
I'm working on jot. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=54879 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: docs/54879: commit references a PR
Date: Mon,  6 Nov 2006 10:30:46 +0000 (UTC)

 dds         2006-11-06 10:30:30 UTC
 
   FreeBSD src repository
 
   Modified files:
     usr.bin/jot          jot.1 jot.c 
   Log:
   Restore jot's ability to use a seed for producing a deterministic
   sequence of random numbers.
   This functionality was lost in revision 1.9 when the random number
   generator was switched to arc4random.
   
   PR:             docs/54879
   MFC after:      2 weeks
   
   Revision  Changes    Path
   1.19      +5 -1      src/usr.bin/jot/jot.1
   1.30      +13 -6     src/usr.bin/jot/jot.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: docs/54879: commit references a PR
Date: Mon,  6 Nov 2006 10:40:25 +0000 (UTC)

 dds         2006-11-06 10:39:49 UTC
 
   FreeBSD src repository
 
   Modified files:
     usr.bin/jot          jot.1 
   Log:
   See also arc4random
   
   PR:             docs/54879
   MFC after:      2 weeks
   
   Revision  Changes    Path
   1.20      +1 -0      src/usr.bin/jot/jot.1
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: dds 
State-Changed-When: Mon Nov 6 13:58:01 UTC 2006 
State-Changed-Why:  
Revision 1.32 of jot.c and 1.21 of jot.1 fix the problem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=54879 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: docs/54879: commit references a PR
Date: Mon,  6 Nov 2006 13:55:38 +0000 (UTC)

 dds         2006-11-06 13:55:11 UTC
 
   FreeBSD src repository
 
   Modified files:
     usr.bin/jot          jot.1 jot.c 
   Log:
   Do What I Mean when the user asks for random integers or characters.
   Up to now jot would fail to generate the last character in the range
   or skew the integer distribution in a way that would generate the numbers
   in the range's limits with half the probability of the rest.
   
   This modification fixes the program, rather than documenting the
   strange behavior, as suggested in docs/54879.
   
   Also, correctly specify the range of random(3).
   
   PR:             docs/54879
   MFC after:      2 weeks
   
   Revision  Changes    Path
   1.22      +18 -1     src/usr.bin/jot/jot.1
   1.32      +32 -7     src/usr.bin/jot/jot.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: dds 
State-Changed-When: Mon Nov 27 09:05:29 UTC 2006 
State-Changed-Why:  
MFCd changes to RELENG_6 

http://www.freebsd.org/cgi/query-pr.cgi?pr=54879 
>Unformatted:
