title: how to generate positive and negative numbers in Java
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3938992/how-to-generate-random-positive-and-negative-numbers-in-java">How to generate random positive and negative numbers in java</a>  </p>
  </blockquote>
  
  
  
  <p>Hello I am trying to create a method in Java to create negative and positive values in Java.</p>
  
  <p>the problem is that I don't know how to get this programmed but I do know the logic.. here is what I tought it should be</p>
  
  <pre><code> Random generator = new Random();
  
   for (int i = 0; i &lt; 21; i++)
   {
         System.out.print(generator.nextInt(100) + 1);
         System.out.println();
   } 
  </code></pre>
  
  <p>but with the code above I get only positive values and I need values between -100 and 100 but how can I accomplish something like that?</p>