mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
534f87a39f
Fix putchar(3) handling and a number of other issues in the random(6) code. In -e mode, avoid bias due to truncation of the return code to 8 bits. In default mode, actually treat the denominator as a floating point number and print the line with a probability of 1 / denominator. This allows e.g. printing 2/3 of stdin with 'random 1.5'. Includes code for uniform random floats by Taylor R. Campbell from https://mumble.net/~campbell/2014/04/28/uniform-random-float and clz64() by me. From lucic71 () bronze ! ctrl-c ! club, thanks. ok deraadt |
||
---|---|---|
.. | ||
Makefile | ||
random.6 | ||
random.c |