Что-то у меня не получилось, подскажите:
SeedRnd(MilliSecs())
Global music_channel%
Global counter
Global channel
Function SelectRandMusic(DIR$)
Local counter%=0
Local channel
Local dir_h%=ReadDir(DIR$)
While True
file$=NextFile$(dir_h)
If Upper$(Right(file$,3))="MP3"
counter=counter+1
EndIf
If file$="" Exit
Wend
CloseDir dir_h
Print "files="+counter
Local iR%=Rand(1,counter%)
If Not counter Return False
counter=0
dir_h%=ReadDir(DIR$)
While True
file$=NextFile$(dir_h)
If Upper$(Right(file$,3))="MP3"
counter=counter+1
If counter%=iR
Print "select - "+IR+" = "+file$
channel=PlayMusic(DIR$+"\"+file$)
Exit
EndIf
EndIf
Wend
Return channel
End Function
ChannelPlaying (channel) If channel=0 Then
SelectRandMusic("music")
