All pastes #767170 Raw Edit

Untitled

public java v1 · immutable
·published 2007-11-09 14:37 UTC
rendered paste body
import java.io.*;import java.math.*;import uk.ac.ed.ph.advcompsim.part3.histogram.*;import uk.ac.ed.ph.advcompsim.part3.closure.*;public class exc318 {	public static void main (String args[]) {		int n 	= 20;							// number of random numbers to be generated		int nb	= 10;								// number of bins to use.		float lb = 3.2f;							// The lower boundary for a->b rand		float ub = 7.9f;							// The upper boundary for a->b rand		float[] datasample1 	= new float[n];		Closure[] datasample2 	= new Closure[n];		for(int i=0;i < n;i++) {			datasample1[i] 	= (float)(lb + (ub-lb)*Math.random());		// place the randomly generated number between a to b in a float			datasample2[i] = new closed();		}		//FunctionHistogram historama1 = new FunctionHistogram(nb, lb, ub, Closed datasample, true);	}}///////and/////import java.io.*;import uk.ac.ed.ph.advcompsim.part3.closure.*;class closed implements Closure {	public float function(float x) {		float f = (float) (Math.pow((double) x, (double)-1/4));			// Math.pow - for the programming language that lost the ^ :(		return f;	}}