summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/funcutils/NumberUtils.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2017-02-09 11:50:31 -0500
committerbculkin2442 <bjculkin@mix.wvu.edu>2017-02-09 11:50:31 -0500
commitd2af58b0f68ebfbba2be7e7679efec6c8c0af12f (patch)
tree2b16fbf014db350126e8c1b5f081312276f85f62 /BJC-Utils2/src/main/java/bjc/utils/funcutils/NumberUtils.java
parent187e1815488e3c1ed22e7592f304e632cffefb82 (diff)
Update
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcutils/NumberUtils.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcutils/NumberUtils.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/NumberUtils.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/NumberUtils.java
index 419c787..24c2014 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/NumberUtils.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/NumberUtils.java
@@ -26,8 +26,7 @@ public class NumberUtils {
} else {
int result = 1;
- for (int currentSub = 0; currentSub < power + 1;
- currentSub++) {
+ for (int currentSub = 0; currentSub < power + 1; currentSub++) {
result *= value - currentSub;
}
@@ -38,16 +37,16 @@ public class NumberUtils {
/**
* Evaluates a linear probability distribution
*
- * @param topExp
+ * @param winning
* The number of winning possibilities
- * @param bottomExp
+ * @param total
* The number of total possibilities
* @param rng
* The function to use to generate a random possibility
* @return Whether or not a random possibility was a winning one
*/
- public static boolean isProbable(int topExp, int bottomExp,
+ public static boolean isProbable(int winning, int total,
Function<Integer, Integer> rng) {
- return rng.apply(bottomExp) < topExp;
+ return rng.apply(total) < winning;
}
}