| Summary: | jot(1) -r description | ||
|---|---|---|---|
| Product: | Documentation | Reporter: | David Brinegar <manjot.3.brinegar> |
| Component: | Books & Articles | Assignee: | Diomidis Spinellis <dds> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Latest | ||
| Hardware: | Any | ||
| OS: | Any | ||
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"
Responsible Changed From-To: freebsd-doc->dds I'm working on jot. 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"
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: open->patched Revision 1.32 of jot.c and 1.21 of jot.1 fix the problem. State Changed From-To: patched->closed MFCd changes to RELENG_6 |
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. 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. 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.