mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Add random int utility function
This commit is contained in:
parent
ff8b7427e3
commit
4937f2d60c
4 changed files with 17 additions and 17 deletions
|
@ -1,3 +1,5 @@
|
|||
import { randomInt } from '../../utils/number.ts';
|
||||
|
||||
let currentId = 0;
|
||||
function addUniquePlaylistItemId(item) {
|
||||
if (!item.PlaylistItemId) {
|
||||
|
@ -56,7 +58,7 @@ class PlayQueueManager {
|
|||
const currentPlaylistItem = this._playlist.splice(this.getCurrentPlaylistIndex(), 1)[0];
|
||||
|
||||
for (let i = this._playlist.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * i);
|
||||
const j = randomInt(0, i - 1);
|
||||
const temp = this._playlist[i];
|
||||
this._playlist[i] = this._playlist[j];
|
||||
this._playlist[j] = temp;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue