I've heard that the randomizer in iTunes might be biased, but I haven't seen any evidence. I wrote a script you can use that is definately random, although I'm not sure if it's exactly what you want.
Basically it creates a new playlist and puts a number of random songs in it. You can edit the initial properties to customize it, changing the name of the destination playlist, the source (main library or selected playlist) and whether you are asked how many songs to get or to use the default number.
I've tried to add sufficient error checking to the script, so hopefully it will be informative if there's an error. Also note that when the new playlist is created, if there is already a playlist with that name it is deleted (although this code can be removed easily enough). The script works by generating random numbers and using them to select songs from the source playlist.
To use the script follow these steps:
1. Copy the code below
2. Open /Applications/AppleScript/Script Editor
3. Paste the code
4. Save it as script, in [home]/Library/iTunes/Scripts/. You may need to create the Scripts folder if it isn't there already.
5. You should now be able to run the script from the Scripts menu in iTunes
Code:
property playlist_Name : "Random" --Name of the destination playlist
property random_source : true --Set this to true to use the Library as the source or false to use the selected playlist as the source
property ask_for_number : true --If true, asks for the number of songs to add to the random playlist. If false, it uses the default number
property default_number : "20" --Default number of random songs to get, used if ask_for_number is set to false
tell application "iTunes"
if ask_for_number is true then
set {numTracks, button} to {text returned, button returned} of (display dialog "How many random tracks?" buttons {"Cancel", "OK"} default button "OK" default answer default_number)
else
set button to "OK"
set numTracks to default_number
end if
if button is equal to "OK" then
set cont to true
try
set theCount to numTracks as integer
if theCount is less than 1 then
display dialog "Number must be greater than 0" buttons "OK" default button "OK"
set cont to false
end if
on error
display dialog "That is not a number" buttons "OK" default button "OK"
set cont to false
end try
if cont then
if exists playlist playlist_Name then
delete playlist playlist_Name
end if
set randPlay to make new user playlist with properties {name:playlist_Name}
if random_source is equal to true then
set theMainPlaylist to playlist "Library"
else
set theMainPlaylist to view of browser window 1
end if
set theTracks to every track of theMainPlaylist
if theCount is greater than (count of theTracks) then
set theCount to count of theTracks
display dialog "Too many tracks. The script will continue with the maximum number possible" buttons "OK" default button "OK"
end if
repeat until theCount is 0
set newTrackNum to random number from 1 to count of theTracks
set newTrack to (item newTrackNum of theTracks)
if not (exists track (name of newTrack) in randPlay) then
duplicate (item newTrackNum of theTracks) to randPlay
set theCount to theCount - 1
end if
end repeat
set view of browser window 1 to randPlay
end if
end if
end tell
As for playcounts, I doubt that they are wrong. For a song's playcount to be increased the end of the song must be played, so if you change songs half way through its playcount won't change.