From 14d915fb7c4703b8a8cdb41046aaba21ad8df448 Mon Sep 17 00:00:00 2001 From: Annika Backstrom Date: Tue, 17 Dec 2019 13:38:55 -0500 Subject: [PATCH] Switch to less complicated track randomizer --- jukebox/library/sqlite-backend.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jukebox/library/sqlite-backend.js b/jukebox/library/sqlite-backend.js index fd867b3..47bf340 100644 --- a/jukebox/library/sqlite-backend.js +++ b/jukebox/library/sqlite-backend.js @@ -10,7 +10,7 @@ class SqliteBackend { find(tag, callback) { this.db.run("INSERT INTO tags (tag) VALUES (?)", tag); - this.db.get("SELECT uuid, tag, label FROM library WHERE tag = ? AND _ROWID_ >= (abs(random()) % (SELECT max(_ROWID_) FROM tags)) LIMIT 1", tag, (err, row) => { + this.db.get("SELECT uuid, tag, label FROM library WHERE tag = ? ORDER BY RANDOM() LIMIT 1", tag, (err, row) => { if (typeof row === 'undefined') { return callback(); }