Skip to content

Commit 42fe475

Browse files
committed
Playlist shuffling fix
1 parent 95c4493 commit 42fe475

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Assets/USharpVideo/Scripts/USharpVideoPlayer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -985,10 +985,10 @@ public void PlayNextVideoFromPlaylist()
985985
{
986986
Random.InitState(_shuffleSeed);
987987

988-
int n = playlist.Length - 1;
989-
for (int i = 0; i < n; ++i)
988+
for (int i = 0; i < playlist.Length - 1; ++i)
990989
{
991-
int r = Random.Range(i + 1, n);
990+
int r = Random.Range(i, playlist.Length);
991+
if (i == r) { continue; }
992992
VRCUrl flipVal = playlist[r];
993993
playlist[r] = playlist[i];
994994
playlist[i] = flipVal;

0 commit comments

Comments
 (0)