Skip to content

one-d-wide/random-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

random-rs

Generate random numbers from CLI

Usage

Quick range: [min] <max>

$ random 100 # min = 0
42
$ random 0 1 --float 6
0.728097

Range: -R <min> <max>

$ random -R -- -100 100
-71

Array: -A <min> <max> <length>

$ random -A 0 100 4 --pretty
 74,  38,   8,  51

String: -S <letters> <length>

$ random -S '0,1' 8 --delimiter ''
01110100
$ random -S 'a,b,c,d' --shuffle
d, c, a, b

Matrix: -M <min> <max> <columns> <rows>

$ random -M 0 100 4 4 --pretty
[
 16,  48,   2,  97;
 88,  69,  13,  85;
 52,  11,  60,   3;
  6, 100,  42,  96;
]

$ random -M 0 100 4 4 --pretty --type diagonal
[
 11,   0,   0,   0;
  0,  83,   0,   0;
  0,   0,   3,   0;
  0,   0,   0,  98;
]

Custom matrix: -C <min> <max> <columns> <rows> <begin> <row_begin> <delimiter> <row_end> <end>

$ random -C 0 1 4 4 "[" " [" "," "]," " ]"
[ [0,1,0,0], [1,1,0,1], [0,0,0,1], [1,0,1,0], ]

Instalation

  • Arch Linux: From AUR.
  • NixOS: nix run github:one-d-wide/random-rs#random
  • Static executable: Check the Releases page.
  • Manual.
    git clone https://github.com/one-d-wide/random-rs.git
    cd random-rs
    cargo build --release
    sudo cp target/release/random-rs /usr/local/bin/random