package TestClasses;
/*
// header - edit "Data/yourJavaHeader" to customize
// contents - edit "EventHandlers/Java file/onCreate" to customize
//
*/
class FloatTest{
	private static int STABILITY_FACTOR = 4;
	public static void main(String[] args){
		double base, d;
		float val;
		base = Double.valueOf("10.00").doubleValue();
		d=base;
		
		for(int i=0; i<100; i++){
			d = Math.abs(d + (float)((Math.random() * STABILITY_FACTOR)-STABILITY_FACTOR/2));
			System.out.println(d);
			val = (float)round(d,2);
			System.out.println(val);
		}
		
		int above=0;
		int below =0;
		for(int j=0; j<1000;j++){
			double value = Math.random();
			if(value>0.5) above++;
			else below++;
		}
		System.out.println("above: "+(double)(above/10.00)+" %");
		System.out.println("below: "+(double)(below/10.00)+" %");
		
	}
	public static double round(double d, int dp){
		double multiple = Math.pow(10, dp);
		return Math.round(d*multiple)/multiple;
	}
}

