> 
> **Possible Duplicate:**  
> 
> [How to generate random positive and negative numbers in java](https://stackoverflow.com/questions/3938992/how-to-generate-random-positive-and-negative-numbers-in-java) 
> 
> 
> 

Hello I am trying to create a method in Java to create negative and positive values in Java.

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

```
 Random generator = new Random();

 for (int i = 0; i < 21; i++)
 {
       System.out.print(generator.nextInt(100) + 1);
       System.out.println();
 } 

```

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?