Is iTunes shuffle function is just a programming language
random() function or it's smarter than that? Does it use play count, skip count and other parameters to play better songs first?
This has been a point for discussion for a very long time!
Here's a great article looking at this exact issue - How Much Does iTunes Like My Five-Star Songs? Bear in mind this is from 2005 but I see very similar behaviour to what is described here.
The standout image for me is this one:
It shows pretty clearly that shuffle does use rating in determining which song to play. I find it strange that mid-rated songs are much more likely to be played than high-rated songs.
AskDifferent user Ian C. did some interesting experiments last year and found that the appearing non-randomness of shuffle is probably due to the algorithm re-using the seed rather than being completely random.
The meaning of this is that shuffle is not truly random, only pseudorandom. As this Random Seed article (Wikipedia) explains, having the seed used in a pseudorandom process will allow you to recreate the same "random" results. True randomness is actually very, very hard to get. (While working on a mobile phone at Siemens years ago a doctor of mathematics had to be brought in to write the random function - the ordinary programmers weren't considered qualified, and the C library function considered inadequate.)