// This example generates a pseudo pointiliste painting // It was derived from a totally different example in // the book _Java in a Nutshell_ by David Flanagan. // You may study, use, modify, and distribute this example for any purpose. // This example is provided WITHOUT WARRANTY either expressed or implied. import java.applet.*; // Don't forget these import statements! import java.awt.*; import java.util.*; // Use Random public class Surat2 extends Applet { /** A demonstration of graphics and the Random Class */ public void init() { }//init /** Number of points in sample */ static final int N=8000; /** Number of colors used */ static final int C=50; /** Size of square in which data is plotted, pixels*/ public static final double size=400.0; /** Size of dot radius in pixels*/ static final int dot=1; /** Range of color component */ static final int NCOLOR=255; /** comput color component */ static int colorComponent(double d) { return (int)(d*NCOLOR); }//colorComponent /** Plots random points

Select color and put small dots at pseudo random places */ public void paint(Graphics g) { int x,y;//Coordinates Random rng=new Random(); //a random number generator. for(int c=0; c