From 2fdccd98d65b03f6550d1824a7c5541cb1d175cf Mon Sep 17 00:00:00 2001 From: Thibaut Horel Date: Thu, 5 May 2016 23:24:44 -0400 Subject: Add Fisher-Yates schuffle --- utils_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'utils_test.go') diff --git a/utils_test.go b/utils_test.go index c42ecef..7b912a0 100644 --- a/utils_test.go +++ b/utils_test.go @@ -1,6 +1,10 @@ package main -import "testing" +import ( + "fmt" + "sort" + "testing" +) func TestLog(t *testing.T) { tests := []struct { @@ -72,3 +76,9 @@ func TestPost(t *testing.T) { } } + +func TestShuffle(t *testing.T) { + a := sort.IntSlice([]int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}) + Shuffle(a) + fmt.Println(a) +} -- cgit v1.2.3-70-g09d2