Version: 2.2 (using KDE KDE 3.4.0) Installed from: FreeBSD Ports Compiler: gcc 3.4.2 OS: FreeBSD When Player->Random Play->Use Random Play is selected, the results are not random. When I click on collection the same song is always selected. Subsequent songs are always in the same sequence. I get the exact same sequence of songs everytime JuK is run. The behavior is as if it uses the same seed everytime for a bad random number generator. There were no problems with the prior versions. Partial contents of jukrc are: [Player] LoopPlaylist=true RandomPlay=Normal Volume=100 [Playlists] CollectionListSortAscending=true CollectionListSortColumn=1 DirectoryList=/alt/share/music ImportPlaylists=false showUpcoming=false [Settings] DockInSystemTray=true DockOnClose=true MediaSystem=1 ShowSplashScreen=true StartDocked=false TrackPopup=false
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();