There are two ways to have a slideshow in iPhoto. From within an album, you can click the Play button and get a quick slideshow. With this method, you have the option to shuffle the order, and play music -- but you can't "fit" the duration of the slideshow to the music.
The other way is to create a slideshow in the sidebar. Here you have the option of setting the duration of each slide to match that of the music (in my case, I had a 20 minute montage), but there is no way to randomize the order -- you have to drag by hand to set the manual order.
My idea is to title the photos with a random number, then sort by title, thereby randomizing the images. Run this AppleScript in Script Editor to do just that:
tell application "iPhoto"
--tell album "photos"
-- Note: change the album name above to reflect the album
-- whose images you'd like to re-title, then remove the "--"
-- at the beginning of the line. Note that if you leave it
-- as "photos," then *every* image in your library will be
-- re-titled!
repeat with aPhoto in photos
set title of aPhoto to ((random number 1000) as string)
end repeat
end tell
end tell
Note: This solution assumes that you have created a separate iPhoto (v7) library for the slideshow, as it re-titles all the images in the library. It is easy to change this to only randomize a specific album; just change the album name in the script from photos to the album name.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20080306101621231