Use a counting loop with a counter from 1 to 1000. The loop body would use a single Random object to pick random X and Y locations for the center of the circles.
Here is a start on this idea:
// assume that the drawing area is 400 by 400 public class ThousandCircles extends Applet { Circle circ = new Circle(); Random rand = _________________; public void paint ( Graphics gr ) { circ.setRadius( 5 ); circ.setColor( Color.red ); int count = 1; while ( count <= 1000 ) { int x = _________________; int y = _________________; circ.setPosition( x, y ); circ.draw( gr ); count = count + 1; } } }
To make sure that each circle completely fits within the applet drawing area, make sure that each center's x and y is at least a distance of 5 (the radius) away from an edge. But let us not do that.