Summary: | Random play is not random | ||
---|---|---|---|
Product: | [Applications] juk | Reporter: | David Johnson <david> |
Component: | general | Assignee: | Scott Wheeler <wheeler> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | Marcin.Kasperski |
Priority: | NOR | ||
Version: | 2.2 | ||
Target Milestone: | --- | ||
Platform: | FreeBSD Ports | ||
OS: | FreeBSD | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | Patch to call srandomdev before random() functions |
Description
David Johnson
2005-03-23 03:39:36 UTC
This seems to happen with random by album as well. not sure if it's just in the newest version, as I never used random by album before. The random by track used to seem random, though. *** Bug 105900 has been marked as a duplicate of this bug. *** Created attachment 11672 [details]
Patch to call srandomdev before random() functions
This will only work on *BSD systems, AFAIK
SVN commit 450391 by mpyne: Fix bug 102238 (Random play is not random between starts) in KDE 3.5, by using KApplication::random() (which will always initialize a random seed) instead of the C library (which may or may not initialize a random seed). CCBUG:102238 M +4 -5 tracksequenceiterator.cpp --- branches/KDE/3.5/kdemultimedia/juk/tracksequenceiterator.cpp #450390:450391 @@ -14,10 +14,9 @@ ***************************************************************************/ #include <kaction.h> +#include <kapplication.h> #include <kdebug.h> -#include <stdlib.h> - #include "tracksequenceiterator.h" #include "playlist.h" #include "actioncollection.h" @@ -89,7 +88,7 @@ if(albumRandom) { if(m_albumSearch.isNull() || m_albumSearch.matchedItems().isEmpty()) { - item = m_randomItems[::random() % m_randomItems.count()]; + item = m_randomItems[KApplication::random() % m_randomItems.count()]; initAlbumSearch(item); } @@ -115,7 +114,7 @@ } } else - item = m_randomItems[::random() % m_randomItems.count()]; + item = m_randomItems[KApplication::random() % m_randomItems.count()]; setCurrent(item); m_randomItems.remove(item); @@ -156,7 +155,7 @@ PlaylistItem *newItem = 0; if(!items.isEmpty()) - newItem = items[::random() % items.count()]; + newItem = items[KApplication::random() % items.count()]; setCurrent(newItem); refillRandomList(); SVN commit 450395 by mpyne: Backport fix for bug 102238 (Random play is not random between starts) to KDE 3.4. BUG:102238 M +4 -5 tracksequenceiterator.cpp --- branches/KDE/3.4/kdemultimedia/juk/tracksequenceiterator.cpp #450394:450395 @@ -14,10 +14,9 @@ ***************************************************************************/ #include <kaction.h> +#include <kapplication.h> #include <kdebug.h> -#include <stdlib.h> - #include "tracksequenceiterator.h" #include "playlist.h" #include "actioncollection.h" @@ -81,7 +80,7 @@ if(albumRandom) { if(m_albumSearch.isNull() || m_albumSearch.matchedItems().isEmpty()) { - item = m_randomItems[::random() % m_randomItems.count()]; + item = m_randomItems[KApplication::random() % m_randomItems.count()]; initAlbumSearch(item); } @@ -107,7 +106,7 @@ } } else - item = m_randomItems[::random() % m_randomItems.count()]; + item = m_randomItems[KApplication::random() % m_randomItems.count()]; setCurrent(item); m_randomItems.remove(item); @@ -148,7 +147,7 @@ PlaylistItem *newItem = 0; if(!items.isEmpty()) - newItem = items[::random() % items.count()]; + newItem = items[KApplication::random() % items.count()]; setCurrent(newItem); refillRandomList(); |