diff --git a/LuaMenu/widgets/snd_music_lite.lua b/LuaMenu/widgets/snd_music_lite.lua index ab9c7a921..3fecc09f1 100644 --- a/LuaMenu/widgets/snd_music_lite.lua +++ b/LuaMenu/widgets/snd_music_lite.lua @@ -35,8 +35,8 @@ local function GetRandomTrack(previousTrack) end end - local randomTrack = math.ceil(math.random()*trackCount) - if randomTrack == previousTrackIndex then + local randomTrack = math.random(1, trackCount) + if randomTrack == previousTrackIndex and previousTrackIndex ~= trackCount then randomTrack = trackCount + 1 end return randomTrackList[randomTrack] @@ -154,13 +154,13 @@ function widget:Initialize() return end + math.randomseed(os.clock() * 100) + openTrack = WG.Chobby.Configuration.gameConfig.openTrack if openTrack == nil then - openTrack = randomTrackList[math.random(#randomTrackList)] + openTrack = randomTrackList[math.random(1, #randomTrackList)] end - math.randomseed(os.clock() * 100) - local Configuration = WG.Chobby.Configuration local function onConfigurationChange(listener, key, value)