File: README.md

package info (click to toggle)
golang-github-shogo82148-go-shuffle 0.0~git20170808.0.5982909-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 80 kB
  • ctags: 32
  • sloc: makefile: 2
file content (38 lines) | stat: -rw-r--r-- 907 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
go-shuffle
=====

[![Build Status](https://travis-ci.org/shogo82148/go-shuffle.svg?branch=master)](https://travis-ci.org/shogo82148/go-shuffle)

Package shuffle provides primitives for shuffling slices and user-defined collections.

``` go
import "github.com/shogo82148/go-shuffle"

// Shuffle slice of int.
ints := []int{3, 1, 4, 1, 5, 9}
shuffle.Ints(ints)

// Shuffle slice of int64.
int64s := []int64{3, 1, 4, 1, 5, 9}
shuffle.Int64s(int64s)

// Shuffle slice of string.
strings := []string{"foo", "bar"}
shuffle.Strings(strings)

// Shuffle slice of float64.
float64s := []float64{3, 1, 4, 1, 5, 9}
shuffle.Float64s(float64s)

// Shuffle slices
shuffle.Slice(ints)
shuffle.Slice(int64s)
shuffle.Slice(strings)
shuffle.Slice(float64s)
```

See [godoc](https://godoc.org/github.com/shogo82148/go-shuffle) for more information.

# LICENSE

This software is released under the MIT License, see LICENSE.md.