aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/random
Commit message (Collapse)AuthorAgeFilesLines
* random(6): Re-add undocumented support for floating point denominatorsConrad Meyer2020-02-154-53/+91
| | | | | | | | | | And document it in the manual page. PR: 244139 Submitted by: Keith White <kwhite AT site.uottawa.ca> (earlier version) Notes: svn path=/head/; revision=357975
* random(6): Fix off-by-oneConrad Meyer2020-01-161-1/+1
| | | | | | | | | | | | | | | | | | After r355693, random(6) -f sometimes fail to output all the lines of the input file. This is because the range from which random indices are chosen is too big, so occasionally the random selection doesn't correspond to any line and nothing gets printed. (Ed. note: Mea culpa. Working on r355693, I was confused by the sometime use of 1-indexing, sometimes 0-indexing in randomize_fd().) Submitted by: Ryan Moeller <ryan AT freqlabs.com> X-MFC-With: r355693 Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D23199 Notes: svn path=/head/; revision=356810
* random(6): produce random resultsConrad Meyer2019-12-134-21/+10
| | | | | | | | This program is trash and there's no reason to keep it in base. But as long as we're shipping a silly program named 'random', let's actually make it random. Notes: svn path=/head/; revision=355693
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Fix a (false positive?) Argument cannot be negative coverity defect.Don Lewis2016-06-081-5/+2
| | | | | | | | | | | | | | | | | | Rather than guarding close(fd) with an fd >= 0 test and setting fd to -1 when it is closed to avoid a potential double-close, just move the close() call after the conditional "goto make_token". This moves the close() call totally outside the loop to avoid the possibility of calling it twice. This should also prevent a Coverity warning about checking fd for validity after it was previously passed to read(). Reported by: Coverity CID: 1355335 MFC after: 1 week X-MFC with: r299484 Notes: svn path=/head/; revision=301574
* random(6): Fix double-closeConrad Meyer2016-05-111-2/+5
| | | | | | | | | | | | | | | | In the case where a file lacks a trailing newline, there is some "evil" code to reverse goto the tokenizing code ("make_token") for the final token in the file. In this case, 'fd' is closed more than once. Use a negative sentinel value to guard close(2), preventing the double close. Ideally, this code would be restructured to avoid this ugly construction. Reported by: Coverity CID: 1006123 Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=299484
* Final step of eliminating the "games" distribution: Merge src/gamesColin Percival2015-10-026-0/+644
(or what's left of it, at least) into src/usr.bin. This change will not be MFCed. Discussed at: EuroBSDCon 2014 Committed from: EuroBSDCon 2015 Notes: svn path=/head/; revision=288485