Personal code for generating mixed CDs of mp3s for my wife to listen to in her car. It's not very pretty, but if you want to use it, knock yourself ouut :-).
The cool thing about it is that chooses songs randomly(-ish), but distributes selections by the same artist evenly across the playlist(s).