Re: random playing soundfiles according to rating.

2006-02-10 Thread Ben Cartwright
kpp9c wrote: > I've been looking at some of the suggested approaches and looked a > little at Michael's bit which works well bisect is a module i > always struggle with (hee hee) > > I am intrigued by Ben's solution and Ben's distilled my problem quite > nicely Thanks!-) Actually, you should

Re: random playing soundfiles according to rating.

2006-02-10 Thread Christos Georgiou
On Fri, 10 Feb 2006 09:59:43 +, rumours say that Ed Singleton <[EMAIL PROTECTED]> might have written: >If speed is no issue (for example you can queue an mp3 while the >current one is playing), then Ben's solution is the classic one. >Store the total of all your scores (or calculate it on the

Re: random playing soundfiles according to rating.

2006-02-10 Thread Ed Singleton
On 8 Feb 2006 19:49:09 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > I am a little bit stuck > > I want to play a bunch of soundfiles randomly, but i want to give each > soundfile a rating (say 0-100) and have the likelihood that the file be > chosen be tied to its rating so that the

Re: random playing soundfiles according to rating.

2006-02-09 Thread kpp9c
I've been looking at some of the suggested approaches and looked a little at Michael's bit which works well bisect is a module i always struggle with (hee hee) I am intrigued by Ben's solution and Ben's distilled my problem quite nicely, but, welli don't understand what "point" is doing wi

Re: random playing soundfiles according to rating.

2006-02-09 Thread Ben Cartwright
[EMAIL PROTECTED] wrote: > But i am stuck on how to do a random chooser that works according to my > idea of choosing according to rating system. It seems to me to be a bit > different that just choosing a weighted choice like so: ... > And i am not sure i want to have to go through what will be

Re: random playing soundfiles according to rating.

2006-02-09 Thread JW
I think of it this way: you randomly pick a entry out of a dictionary, then roll a 100-side die to see if the pick is "good enough". Repeat until you find one, or give up. import random def rand_weighted_pick(weighted_picks): for i in range(100): name, prob = random.choice(weighted_p

Re: random playing soundfiles according to rating.

2006-02-08 Thread Michael Spencer
[EMAIL PROTECTED] wrote: ... > > But i am stuck on how to do a random chooser that works according to my > idea of choosing according to rating system. It seems to me to be a bit > different that just choosing a weighted choice like so: > ... > > And i am not sure i want to have to go through w

Re: random playing soundfiles according to rating.

2006-02-08 Thread Steve Holden
[EMAIL PROTECTED] wrote: > I am a little bit stuck > > I want to play a bunch of soundfiles randomly, but i want to give each > soundfile a rating (say 0-100) and have the likelihood that the file be > chosen be tied to its rating so that the higher the rating the more > likely a file is to b

random playing soundfiles according to rating.

2006-02-08 Thread kp87
I am a little bit stuck I want to play a bunch of soundfiles randomly, but i want to give each soundfile a rating (say 0-100) and have the likelihood that the file be chosen be tied to its rating so that the higher the rating the more likely a file is to be chosen. Then i need some addition