An open API service indexing awesome lists of open source software.

https://github.com/nemuelw/shuffler

Go package with 6 popular shuffling algorithms
https://github.com/nemuelw/shuffler

algorithms durstenfeld fisher-yates-shuffle golang golang-package knuth-algorithm riffle-shuffle sattolo shuffle shuffling shuffling-algorithm

Last synced: 11 months ago
JSON representation

Go package with 6 popular shuffling algorithms

Awesome Lists containing this project

README

          

# shuffler

Go package with 6 popular shuffling algorithms

## Installation

```
go get github.com/nemzyxt/shuffler
```

## Usage

Example:

```
package main

import (
"fmt"
"github.com/nemzyxt/shuffler"
)

func main() {
arr := [5]int{1, 2, 3, 4, 5}
shuffler.FisherYatesShuffle[int](arr[:]) // use the Fisher-Yates algorithm
fmt.Println(arr)
}
```

## Supported Algorithms

- Fisher-Yates Shuffle
- Knuth Shuffle
- Sattolo's Shuffle
- Durstenfeld Shuffle
- Cohen's Shuffle
- Riffle/Perfect Shuffle