#shell #random-seed #bash #script #fish #range #helper

bin+lib seed_gen

A small helper to work with seeds in shell scripts

3 stable releases

1.2.0 Aug 21, 2024
1.1.0 Aug 19, 2024
1.0.0 Aug 13, 2024

#2244 in Command line utilities

Download history 264/week @ 2024-08-13 200/week @ 2024-08-20 29/week @ 2024-09-10 17/week @ 2024-09-17 21/week @ 2024-09-24 41/week @ 2024-10-01

108 downloads per month

Custom license

7KB
114 lines

seed_gen

A small helper tool that can be used when you need one or multiple seeds in a bash script.

Example

If you want to call something with 10 random seeds you can do something like this:

# bash example

for seed in $(seed_gen random 10);
do
  echo "$seed"
done
# fish example

for seed in (seed_gen r 10)
  echo "$seed"
end

Usage

Usage: seed_gen <COMMAND>

Commands:
  single  Returns the provided seed. If seed is a string, it is hashed beforehand [aliases: s]
  random  Returns the specied amount of random seeds [aliases: r, rand]
  range   Returns numbers in a range
  full    Generates all values from u64::MIN to u64::MAX
  help    Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help

Subcommands

Single

Returns the provided seed. If seed is a string, it is hashed beforehand

Usage: seed_gen single <SEED>

Arguments:
  <SEED>  The specified seed

Options:
  -h, --help  Print help

Random

Returns the specied amount of random seeds

Usage: seed_gen random [COUNT]

Arguments:
  [COUNT]  The amount of seeds to print

Options:
  -h, --help  Print help

Range

Returns numbers in a range

Usage: seed_gen range [OPTIONS] <MIN> <MAX>

Arguments:
  <MIN>  The lowest number to print
  <MAX>  The highest number to print

Options:
  -s, --step <STEP>  The step size between two numbers
  -h, --help         Print help

Full

Generates all values from u64::MIN to u64::MAX

Usage: seed_gen full

Options:
  -h, --help  Print help

Dependencies

~1.4–2MB
~38K SLoC