Reply to thread

I stole the shuffle code from the playlist class.  It should generate a unique order each time the slideshow is started:


[code]

    public void Shuffle()

    {

      Random r = new System.Random( DateTime.Now.Millisecond );

      int nItemCount = m_slides.Count;


      // iterate through each catalogue item performing arbitrary swaps

      for ( int nItem=0; nItem < nItemCount; nItem++ )

      {

        int nArbitrary = r.Next( nItemCount );


        if ( nArbitrary != nItem )

        {

          string anItem = (string)m_slides[ nArbitrary ];

          m_slides[ nArbitrary ] = m_slides[ nItem ];

          m_slides[ nItem ] = anItem;

        }

      }

    }


[/code]


Top Bottom