summaryrefslogtreecommitdiffstats
path: root/games/random/randomize_fd.c
Commit message (Collapse)AuthorAgeFilesLines
* Free buf when its no longer used. This helps eliminate a static analysiseadler2012-10-221-0/+2
| | | | | | | | | warning. PR: ports/172566 Submitted by: Erik Cederstrand <erik@cederstrand.dk> Approved by: cperciva MFC after: 3 days
* random(6): avoid dead assignmentsuqs2010-06-141-1/+1
| | | | Found by: clang static analyzer
* Suggections from bde@ache2008-08-111-4/+9
| | | | | | | | 1) Split too long source lines 2) Portable code should not assume that null pointer == all-bits-0, so back out prev. calloc() change. Submitted by: bde
* All cosmetic.ache2008-08-101-8/+5
| | | | | | 1) Rename RANDOM_MAX to RANDOM_MAX_PLUS1 to not confuse with random()'s max 2) Use calloc() instead of zeroing fields explicitly 3) "too many lines" -> "too many delimiters" for err()
* 1) Fix longstanding math bug with denominator > 1 (wrong probability).ache2008-08-081-8/+16
| | | | | | | | | | Test case: random -f some_small_file 10000 (in most cases must be no output) 2) Prevent number of lines > RANDOM_MAX (overflow or nothing may be choosed) with EFBIG err() 3) After line is found, terminate list loop for -U case too, since nothing to do in the rest of the loop left.
* I was confused a bit by the wrong construction with RAND_MAXache2008-08-081-1/+1
| | | | | | | | | | used in randomize_fd.c. Although the max value is the same currently, RAND_MAX is for rand(), not for random(). So move RANDOM_MAX const to the common file now, make it UL and use in randomize_fd.c too. (in any case its old value was 1 less then must be, as noted in the prev. commit)
* 1) Fix hang at the end of line buffer (PR 95715)ache2006-04-141-8/+7
| | | | | | | 2) Localize PR: 95715 Submitted by: Li-Lun Wang <llwang@infor.org> (slightly edited by me)
* flexlint rears its head as well as some style(9) fixes[1]. Fixed aseanc2003-02-151-51/+69
| | | | | | | | | few bugs for a few corner cases and correctly handle the case where read(2) is read()'ing from a non-file descriptor and could get fewer bytes back than the buffer, but it isn't EOF[2]. random(6) extensively tested and believed to be bug free (save performance for large files). Submitted by: mkm [1], tjr[2]
* Update random(6) to have the ability to randomize a file/stdin basedseanc2003-02-111-0/+219
off of lines or words. See the man page for details. Reviewed by: markm MFC after: 3 days
OpenPOWER on IntegriCloud