# pyshuf2
[![PyPI version](https://img.shields.io/pypi/v/pyshuf2?color=blue)](https://pypi.org/project/pyshuf2/)
[![License](https://img.shields.io/github/license/matthewyang204/pyshuf2)](https://github.com/matthewyang204/pyshuf2/blob/main/LICENSE)
[![PyPI downloads](https://static.pepy.tech/personalized-badge/pyshuf2?period=total&units=ABBREVIATION&left_color=GREY&right_color=GREEN&left_text=downloads)](https://pepy.tech/projects/pyshuf2)

An inexact clone of GNU shuf. Free, implemented in Python.

### Install
pyshuf2 can be installed via pip:
```
pip install pyshuf2
```

If you are installing the development version, just clone the repo & run this inside the cloned directory:
```
pip install -e .
```
This will also allow you to edit the program and then re-run it without reinstalling.

### Usage

Same as shuf, but the script is invoked with pyshuf2. Read the [GNU
manual](https://www.gnu.org/software/coreutils/manual/html_node/shuf-invocation.html)
for shuf for more details.

### "Cookbook" 

Generate a random number from 0 to 99

     $ pyshuf2 -i 0-99 -n 1
     73

Pick a random word from the dictionary (dictionary location may vary)

     $ pyshuf2 --input-file /usr/share/dict/words -n 1
     irreflectiveness

Shuffle the first 10 words from the dictionary

     $ head /usr/share/dict/words | pyshuf2
     aardvark
     aalii
     Aaron
     a
     aa
     Aani
     aam
     aardwolf
     A
     aal

Use input from the command line

     pyshuf2: error: argument -e/--echo: ignored explicit argument 'cho'
     $ pyshuf2 --echo one two three four five
     four
     two
     three
     one
     five

### Features implemented

    --e, --echo
    -i, --input-range
    -n, --head-count
    -o, --output-file

### Features not implemented

    --random-source
    -r, --repeat
    -z, --zero-terminated

### Features added that are not present in GNU shuf

    --input-file	specify an input file to read from

### This is a Fork
Please note that this is a fork of [jakekara/pyshuf](https://github.com/jakekara/pyshuf).
