Code example for BigDecimal

Methods: multiplysubtract

	 * @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();
Stop searching for code, let great code find you!  Add Codota to your java IDE