Okay so I need to come up with a formula that is 100% accurate for my plugin. Code:java String[] parts = plugin.getConfig().getString("Cash.Chicken").split("-"); String min = parts[0];String max = parts[1]; float maxAmount = Float.parseFloat(max);float minAmount = Float.parseFloat(min); double cash = Math.random() * maxAmount; if(cash < minAmount){cash = minAmount + minAmount * Math.random();} plugin.econ.depositPlayer(p.getName(), cash); Okay so Math.Random() = 0 - 0.9999999999 Let's say I have a range of numbers = 2-3 2 = min 3 = max cash = math.random() * maxAmount (maxAmount is equal to max, which is equal to 3) math.random can generate any random number in between 0 and 1, i cannot control it. so essentially cash can be = 0.9 * 3 which is 2.7 or it can be = 0.1 * 3 which is 0.6. 0.6 is not in the range of 2-3. So that is where: if cash is less than minAmount (2), which it was, it was 0.6 then make cash = ________________________ (I need a formula, the one I use is not 100% accurate)
Code:java Random r = new Random();int cash = r.nextInt(3-2)+ 2; 3 is the high value, and 2 is the low value.