On 22/04/16 14:48, Adam Borowski wrote: > On Thu, Apr 21, 2016 at 11:11:39PM -0700, Rudi Cilibrasi wrote: >> * Package name : flipcoin >> * URL : https://github.com/rudi-cilibrasi/flipcoin >> Description : flip an adjustable coin for random exit status >> >> This command-line utility can be used to simulate a coin flip to get >> a random exit status. The probability of success is adjustable using >> an optional command line parameter. > [...] >> This package is a useful core utility for shell scripts that need to >> do things in a way that is decorrelated in time and infrequent. Usage is >> simple at the shell prompt: >> >> if flipcoin ; then echo heads ; else echo tails ; fi > > Sorry, but I don't believe that someone writing shell scripts is likely to > not know one of many ways to do this, be it $RANDOM, perl, awk, or, if you > really want to require something non-essential, rolldice. > > Thus, please reconsider the point of packaging this. > > > Meow! > Indeed. With bash:
flipcoin() { return $(($RANDOM % 2)); } if flipcoin ; then echo heads ; else echo tails ; fi :)
signature.asc
Description: OpenPGP digital signature