title: Creating objects with random attributes
body: <p>I'm building a railway simulator including the classes Passenger and Station (among others). The Passenger class has an attribute endLoc, which will be the desired end location for each passenger (i.e. a station object). I'm generating a random number of passengers at each station on my network into an ArrayList, and would like their attribute of endLoc to be randomly generated as well (out of a list of all the station objects), but I can't work out how to make the attribute be a random one from a list each time. </p>
  
  <pre><code>    ArrayList&lt;Passenger&gt; passengers = new ArrayList&lt;Passenger&gt;();
      for (int i = 0; i&lt;p; i++){
          passengers.add(new Passenger(statA));
  </code></pre>
  
  <p>i.e. Once I have my random number, and have it mapped to which station I want, what do I put in the code instead of statA, to mean the station that applies to my random number?</p>
  
  <p>Can anyone tell me how to do this, or at least point me in the right direction? Thanks.</p>