title: Java Programming: Array's and Random Gen
body: <p>I have an assignment to create a program that generates random "poems". Here is my code:</p>
  
  <pre><code>package poem;
  
  import java.util.Random;
  
  
  public class Poem {
  
      public static void main(String[] args) {
          String rhyme1[] = {"ball", "call", "mall", "hall", "guy named Paul"};
          String rhyme2[] = {"cat","hat", "bat", "rat", "mat", "guy named Pat"};
          String nouns[] = {"you", "I", "girl", "boy", "man", "woman"};
          String verbs[] = {"run", "jump", "dive", "sink", "fall", "collapse", "swim", "love"};
          String others[] = {"like a", "into a", "nothing like a"};
  
          Random gen = new Random();
  
          String currentNoun = nouns[gen.nextInt(nouns.length)];
          String currentVerb = verbs[gen.nextInt(verbs.length)];
          String currentRhyme1 = rhyme1[gen.nextInt(rhyme1.length)];
          String currentRhyme2 = rhyme2[gen.nextInt(rhyme2.length)];
          String currentOther = others[gen.nextInt(others.length)];
  
          System.out.printf("%s %s %s %s \n", currentNoun, currentVerb, currentOther, currentRhyme1);
          System.out.printf("%s %s %s %s \n", currentNoun, currentVerb, currentOther, currentRhyme1);}}
  </code></pre>
  
  <p>My question is, when I run it I get the exact same line both times.
  How do I get a different, randomly generated line every time? Thanks in advance.</p>