Docstoc

MGingen.java

Document Sample
MGingen.java Powered By Docstoc
					import java.io.*; import java.util.*; public class MGingen { public static void main(String args[]) throws IOException { PrintWriter out; int vertices = 5; int edges = 7; int histlen = 125; out = new PrintWriter(new BufferedWriter(new FileWriter("dv.in"))); int start = 0; int end = edges-1; out.println(vertices+" "+edges+" "+start+" "+end+" "+histlen); boolean used[][] = new boolean[vertices][vertices]; for(int e=0; e<edges; e++) { int a = (int)(vertices*Math.random()); int b = (int)(vertices*Math.random()); if(a==b||used[a][b]) {e--;continue;} used[a][b] = true; used[b][a] = true; int on = (int)(2*Math.random()); out.println(a+" "+b+" "+on); for(int h=0; h<histlen; h++) { if(Math.random()>0.5) on=1-on; out.println(on); } } out.close(); System.exit(0); } }


				
DOCUMENT INFO
Shared By:
Categories:
Stats:
views:3
posted:1/3/2010
language:English
pages:1