Code example for BigDecimal

Methods: multiply, subtract

0
	 * @return 
	 */ 
	public static BigDecimal generateProbabiltyValue(BigDecimal min)
	{ 
		//get the range, casting to long to avoid overflow problems 
		BigDecimal range = BigDecimal.ONE.subtract(min);
		// compute a fraction of the range, 0 <= frac < range 
		BigDecimal fraction = range.multiply(BigDecimal.valueOf(generateRandom()));
		//int randomNumber =  (int)(fraction + aStart);     
		return fraction;
	} 
	  
	public static Double generateRandom()
	{ 
		Random random = new Random(new Date().getTime());
 
		return random.nextDouble();
	} 
 
}