(might be buggy, feel free to fix)

x = GetSendToItems
 
Randomize
num = ubound(x)
 
if ubound(x) > 0 Then
 plpos = playlist.count + 1
 
do while (num>0)    
   Rand = Int(num * Rnd+1)
   x(Rand).enqueue
   x(Rand) = x(num)
   num = num - 1
Loop
 
 playlist.position = plpos
 play
End If
quit

Another contributed method, though not as efficient.

x = GetSendToItems
 
Randomize
tracks = 0
num = ubound(x)
 
if ubound(x) > 0 Then
 plpos = playlist.count + 1
 
set dict = CreateObject("Scripting.Dictionary")
 
do while (tracks<num)    
   Rand = Int(ubound(x) * Rnd+1)
  
   neu = Rand
   alt = num
 
    do
    If not dict.Exists(neu) then
      dict.Add neu, alt
    else
     exit do
    end if
 
    x(Rand).enqueue
    tracks=tracks+1
    loop
Loop
 
 playlist.position = plpos
  play
End If
 
quit
 
examples/sendto/play_and_randomize.txt · Last modified: 2006/11/06 15:45
 
Recent changes RSS feed Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Music Plugins