6 Replies Latest reply: Feb 10, 2008 10:41 AM by 807603 RSS

    How do I randomly pick any ArrayList index?

    807603
      Hi,

      My problem is that, I have an ArrayList with a number of entries in.. Each iteration that this ArrayList is read the ArrayList index should decrease by 1.

      What I am trying to do though is randomly select an index within the ArrayList to get a value from.

      Would I use Java's random function to generate a random number according to the size of the ArrayList.

      Thus given me a random index..?