Bug#44807: Hayes randomize mode unusable

Carsten Pfeiffer carpdjih at sp.zrz.tu-berlin.de
Sat Jul 6 23:47:28 BST 2002


-----BEGIN PGP SIGNED MESSAGE-----

On Saturday 06 July 2002 22:16, Neil Stevens wrote:

> Well, as it turns out, it's hard to get a well-distributed shuffle mode
> when you have a policy of not opening directories in the KFileTreeView
> unless absolutely necessary.

I see -- you don't know the entire domain before. 

What do you think of this idea:

You start with reading the toplevel directory, so you know its contents (files 
and directories). Every file gets a weight of 1, every directory a weight of 
say 50 (just a guessed number). 

Now you choose a random file in the toplevel hierarchy. Directories will have 
a higher probability to get hit, due to their bigger weight. As soon as a 
directory is chosen, you read its contents, and adjust its weight accordingly 
(sum of the weight of all its files + its directories).

Repeat this until you have chosen a file.

Additionally, you could keep a list of filenames that have been played already 
and continue choosing, if necessary. You will know when you have played all 
files (number of files == number of played files && no unread directories).

> Working on it, though. :-)

Looking forward :)

Cheers
Carsten Pfeiffer
-----BEGIN PGP SIGNATURE-----

iQEVAwUBPSdzgaWgYMJuwmZtAQGMeQf/XmgaP8+MFpsGTpe8o7PC1KI2XbLm/LL8
qW5gyWYt6aazVyZYtKqOYVbSLsSPQ+hvmG8wTxck8c+2JSo567jaH3bhxs5ocLhH
vDEBXTtF6sayuAp6YAT7KHXxWMwMBWMmUTxLqay4HNQueppGF6x7rpIHEzNeJTuS
oMFxoWjC4Wkwyaw20jrUJwy/CPVifc8fj1+Vol1EW+m0c5MwLx3gDL4NrCVtyVZB
Q7N+M9oGsmRvPjvtbaTE51INsKAWJqfnkFN/zvHlyGOZq7EyjwZIkkN67THZqpRh
vHLvwJzLPFwFjwJL40E/zqIuBSOQoWDeiI/a0iyiNTI1UdcUbXHaCg==
=R2RZ
-----END PGP SIGNATURE-----

(Complete bug history is available at http://bugs.kde.org/db/44/44807.html)



More information about the kde-multimedia mailing list