First you must create a Random object, for example:
Random r = new Random();
And then, if you want an int value, you should use nextInt int myValue = r.nextInt (max);
Now, if you want in between just do:
int myValue = r.nextInt(max-offset)+offset;
In your case:
int myValue = r.nextInt(300)+200;
You should check the documents:
http://docs.oracle.com/javase/6/docs/api/java/util/Random.html
source share