[mythtv] MythMusic playlists still not intelligent enough IMHO
stevehodge at gmail.com
Thu Apr 19 00:11:37 UTC 2007
On 4/19/07, Eskil Heyn Olsen <myth at eskil.org> wrote:
> On Wed, 2007-04-18 at 10:50 -0400, Dan Wilga wrote:
> > - assume songs are in an array
> > - assume N is the length of the array (the number of songs in the list)
> > - find a prime number, P, such that it is guaranteed to be larger
> > than N and yet P+N <= MAX_INT
> > - choose the index of the first song, S, randomly: S = rand() % N
> > - afterward, each new song, S' is calculated like so: S' = (S + P) % N
> Interesting, I'd be interested in taking a stab at this just for the
> hell of it. But what if the N >= MAX_INT/2 entries, than there won't be
> any P that satisfies the criteria ? Will chosing the highest P' such
> that P'+N <= MAX_INT but P' < N still yield fairly good randomness ?
> Or just assume that people with 32k songs in a playlist don't care ?
32 bit ints? I doubt anyone will manage a billion song playlist anytime
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the mythtv-dev