[mythtv] MythMusic playlists still not intelligent enough IMHO

Steve Hodge 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
soon.

Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-dev/attachments/20070419/ebcfa0e8/attachment.htm 


More information about the mythtv-dev mailing list