aboutsummaryrefslogtreecommitdiff
path: root/src/app.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.go')
-rw-r--r--src/app.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/app.go b/src/app.go
index ee1b342..b998a50 100644
--- a/src/app.go
+++ b/src/app.go
@@ -2,7 +2,9 @@ package src
2 2
3import ( 3import (
4 "fmt" 4 "fmt"
5 "math/rand"
5 "os" 6 "os"
7 "time"
6 8
7 "git.sixfoisneuf.fr/termsonic/music" 9 "git.sixfoisneuf.fr/termsonic/music"
8 "github.com/delucks/go-subsonic" 10 "github.com/delucks/go-subsonic"
@@ -158,3 +160,13 @@ func (a *app) switchToPage(name string) {
158 160
159 a.updateFooter() 161 a.updateFooter()
160} 162}
163
164func randomize(t []*subsonic.Child) []*subsonic.Child {
165 t2 := make([]*subsonic.Child, len(t))
166 copy(t2, t)
167
168 rand.Seed(time.Now().UnixNano())
169 rand.Shuffle(len(t2), func(i, j int) { t2[i], t2[j] = t2[j], t2[i] })
170
171 return t2
172}