1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Going through a list in a random way?

Discussion in 'General Programming Chat' started by Nick1, Feb 10, 2012.

  1. Nick1

    Nick1 Junior Member

    Joined:
    Oct 16, 2009
    Messages:
    196
    Likes Received:
    45
    Ok guys, I want to go through a list (1 2 3 4 5...) of about 10 000 entries in a random way (so that it might go 495... then 366... then 390,etc). I have to go through each of the entries in a random fashion.

    I'm not sure as to how to proceed about it in an efficient fashion.:confused:
     
  2. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,468
    Likes Received:
    10,143
    Shuffle the list first, go through it linearly afterwards.
     
    • Thanks Thanks x 2