All pastes #766045 Raw Edit

Untitled

public java v1 · immutable
·published 2007-11-08 15:59 UTC
rendered paste body
package uk.ac.ed.ph.advcompsim.part3.histogram;import java.io.*;import java.math.*;/** * --------------------------------------------------------------- * Excersize 3.1.3 * ---------------------------------------------------------------<br /> * I would expect the histogram to be fairly flat, because over a large number of N I would expect the probability of getting a value in the region * 0-0.1 to be the same as that of getting a number in the region 0.4-0.5 for example.*/public class exc313 {	/**	* Takes a number n and prints that many random numbers.	*/	public static void main (String args[]) {		int n 	= 200;								// number of random numbers to be generated		int nb	= 10;								// number of bins to use.		float[] data = new float[n];				// The data array		float lb = 0;								// The lower boundary		float ub = 1;								// The upper boundary		for(int i=0;i < n;i++) {			data[i] = (float)(Math.random());		// print the randomly generated number to screen		}		DataHistogram Pie = new DataHistogram(nb, lb, ub, data, true);	}}