x First time here? Check out the FAQ

Learn from 350 other Umbracians at the annual Umbraco Conference - CodeGarden '13.
More than twenty high quality sessions, open spaces, hackathons and social events you'll remember. Not to be missed!
Less than 25 tickets left - get yours now!

  • Avatar275posts538karma

    DynamicNodeList shuffling

    mkariti started this topic March 4, 2012 @ 01:48 , this topic was edited at: Sunday, March 4, 2012 2:43 PM, Go directly to the topic solution

    Hi there,

    Is there an quick way to shuffle DynamicNodeList?

    Cheers

    mkariti


  • Replies

  • mkariti posted this reply March 4, 2012 @ 02:43

    Got it! I used this:

     

    Random r = new Random(); 
         for (int n = pagesToList.Count() - 1; n > 0; --n)
         {
             int k = r.Next(n + 1);
             DynamicNode temp = pagesToList.Items[n];
             pagesToList.Items[n] = pagesToList.Items[k];
             pagesToList.Items[k] = temp;
         }
      

Please login or Sign up To post replies