A random command line tool to do random stuff
Pick one from multiple options passed in as parameters or via standard input (stdin
).
From parameters:
$ random pick π π π π
π
From stdin
:
$ echo π π π π | random pick
π
Combined parameters and stdin
:
$ echo π π | random pick π π
π
When stdin
contains multiple lines, a random line is selected:
$ ls | random pick
Package.swift
$ ls -la | random pick
-rw-r--r-- 1 enekoalonso staff 1069 Sep 14 22:27 LICENSE
If a single word is passed in, a random character is selected:
$ random pick eneko
e
Shuffle options passed in as parameters or via standard input in random order (stdin
).
$ random shuffle π π π π
π
π
π
π
Throw one or multiple dice.
$ random dice
2
Multiple throws:
$ random dice -n 6
1
6
6
1
6
3
Note: Requires Swift 4.2, works on Mac and Linux
$ brew install eneko/tap/random
$ git clone https://github.com/eneko/Random.git
$ cd Random
$ make
$ curl -Ls https://github.com/eneko/Random/releases/download/latest/random.macos.zip -o /tmp/random.macos.zip
$ unzip -j -d /usr/local/bin /tmp/random.macos.zip