Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
d5f996ac
Commit
d5f996ac
authored
Sep 15, 2009
by
Ilkka Ollakka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist: use Fisher-Yater shuffle instead naive when randomising playlist
parent
238aa1c9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
7 deletions
+3
-7
src/playlist/sort.c
src/playlist/sort.c
+3
-7
No files found.
src/playlist/sort.c
View file @
d5f996ac
...
@@ -141,16 +141,12 @@ void playlist_ItemArraySort( unsigned i_items, playlist_item_t **pp_items,
...
@@ -141,16 +141,12 @@ void playlist_ItemArraySort( unsigned i_items, playlist_item_t **pp_items,
else
/* Randomise */
else
/* Randomise */
{
{
unsigned
i_position
;
unsigned
i_position
;
unsigned
i_new
;
playlist_item_t
*
p_temp
;
playlist_item_t
*
p_temp
;
for
(
i_position
=
0
;
i_position
<
i_items
;
i_position
++
)
for
(
i_position
=
i_items
-
1
;
i_position
>
0
;
i_position
--
)
{
{
int
i_new
;
i_new
=
rand
()
%
i_position
;
if
(
i_items
>
1
)
i_new
=
rand
()
%
(
i_items
-
1
);
else
i_new
=
0
;
p_temp
=
pp_items
[
i_position
];
p_temp
=
pp_items
[
i_position
];
pp_items
[
i_position
]
=
pp_items
[
i_new
];
pp_items
[
i_position
]
=
pp_items
[
i_new
];
pp_items
[
i_new
]
=
p_temp
;
pp_items
[
i_new
]
=
p_temp
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment