aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/gregtech/api/objects/GT_UO_Fluid.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java
index 36f98d6cae..e43f80913e 100644
--- a/src/main/java/gregtech/api/objects/GT_UO_Fluid.java
+++ b/src/main/java/gregtech/api/objects/GT_UO_Fluid.java
@@ -53,9 +53,11 @@ public class GT_UO_Fluid {
public int getRandomAmount(
Random aRandom) { // generates some random ass number that correlates to extraction speeds
- int div = (int) Math.floor(Math.pow((MaxAmount - MinAmount) * 100.d * DIVIDER, 0.2d));
- int min = (int) Math.floor(Math.pow(MinAmount * 100.d * DIVIDER, 0.2d));
- double amount = min + aRandom.nextInt(div) + aRandom.nextDouble();
- return (int) (Math.pow(amount, 5) / 100); // reverses the computation above
+ int smax = (int) Math.floor(Math.pow(
+ MaxAmount * 100.d * DIVIDER,
+ 0.2d)); // use scaled max and min values for the randomness to make high values more rare.
+ double smin = Math.pow(MinAmount * 100.d * DIVIDER, 0.2d);
+ double samount = Math.max(smin, aRandom.nextInt(smax) + aRandom.nextDouble());
+ return (int) (Math.pow(samount, 5) / 100); // reverses the computation above
}
}