Initial commit

This commit is contained in:
Donny
2019-04-22 20:46:32 +08:00
commit 49ab8aadd1
25441 changed files with 4055000 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
package shuffle
import (
"strings"
"testing"
)
type List []string
func (l List) Len() int {
return len(l)
}
func (l List) Swap(i, j int) {
l[i], l[j] = l[j], l[i]
}
func TestShuffle(t *testing.T) {
l := List{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"}
old := strings.Join(l, "")
Shuffle(l)
new := strings.Join(l, "")
if old == new {
t.Errorf("shuffle error, %s == %s", old, new)
}
t.Log(new)
}