/* From: "A SURVEY OF COMPUTATIONAL PHYSICS" by RH Landau, MJ Paez, and CC BORDEIANU Copyright Princeton University Press, Princeton, 2008. Electronic Materials copyright: R Landau, Oregon State Univ, 2008; MJ Paez, Univ Antioquia, 2008; and CC BORDEIANU, Univ Bucharest, 2008. Support by National Science Foundation */ // Walk.java Random walk simulation import java.io.*; // Location of PrintWriter import java.util.*; // Location of Random import java.lang.*; // Location of Math public class Walk { public static void main(String[] argv) throws IOException, FileNotFoundException { PrintWriter q = new PrintWriter( new FileOutputStream("Walk.dat"), true); int jmax = 100, i; double x, y; x = 0. ; y = 0. ; // Start at origin for ( i=0; i <= jmax; i++ ) { q.println(" " + x + " " + y); // Print points x += (Math.random()-0.5)*2.; // Random -1=