Bug 244139 - random(6) since r355693 does not support a double value for denominator
Summary: random(6) since r355693 does not support a double value for denominator
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2020-02-15 14:29 UTC by Keith White
Modified: 2020-02-15 19:14 UTC (History)
1 user (show)

See Also:

allow denomitator to be a double again (1.25 KB, patch)
2020-02-15 14:29 UTC, Keith White
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Keith White 2020-02-15 14:29:53 UTC
Created attachment 211671 [details]
allow denomitator to be a double again

random(6) pre-r355693 supported a double value for denominator.  This made it possible to select roughly 99%, say, of the lines in an input file using "random 1.01", or roughly 51% of the lines with "random 1.96".  Both these cases are now equivalent to "random 1" and return all lines.

The attached patch returns this functionality.  Salt to taste.

[Patch r356810 resolved another problem with r355693.]
Comment 1 commit-hook freebsd_committer 2020-02-15 19:13:43 UTC
A commit references this bug:

Author: cem
Date: Sat Feb 15 19:13:38 UTC 2020
New revision: 357975
URL: https://svnweb.freebsd.org/changeset/base/357975

  random(6): Re-add undocumented support for floating point denominators

  And document it in the manual page.

  PR:		244139
  Submitted by:	Keith White <kwhite AT site.uottawa.ca> (earlier version)

Comment 2 Conrad Meyer freebsd_committer 2020-02-15 19:14:08 UTC