summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/funcutils/NumberUtils.java
diff options
context:
space:
mode:
authorBenjamin J. Culkin <bjculkin@mix.wvu.edu>2017-10-11 22:49:16 -0300
committerBenjamin J. Culkin <bjculkin@mix.wvu.edu>2017-10-11 22:49:16 -0300
commit8923edffdb36b790014ff47301e53f7ede93ea0d (patch)
treee1cff9168eb79110a8832249d208f2978f549a04 /base/src/main/java/bjc/utils/funcutils/NumberUtils.java
parent946cab444bc301d8a7c756a1bab039558288de89 (diff)
Cleanup more
Diffstat (limited to 'base/src/main/java/bjc/utils/funcutils/NumberUtils.java')
-rw-r--r--base/src/main/java/bjc/utils/funcutils/NumberUtils.java42
1 files changed, 24 insertions, 18 deletions
diff --git a/base/src/main/java/bjc/utils/funcutils/NumberUtils.java b/base/src/main/java/bjc/utils/funcutils/NumberUtils.java
index 770d3a5..c3d52fa 100644
--- a/base/src/main/java/bjc/utils/funcutils/NumberUtils.java
+++ b/base/src/main/java/bjc/utils/funcutils/NumberUtils.java
@@ -3,27 +3,29 @@ package bjc.utils.funcutils;
import java.util.function.Function;
/**
- * Utility functions for dealing with numbers
+ * Utility functions for dealing with numbers.
*
* @author ben
- *
*/
public class NumberUtils {
/**
- * Compute the falling factorial of a number
+ * Compute the falling factorial of a number.
*
* @param value
- * The number to compute
+ * The number to compute.
+ *
* @param power
- * The power to do the falling factorial for
- * @return The falling factorial of the number to the power
+ * The power to do the falling factorial for.
+ *
+ * @return
+ * The falling factorial of the number to the power.
*/
public static int fallingFactorial(final int value, final int power) {
- if (power == 0)
+ if (power == 0) {
return 1;
- else if (power == 1)
+ } else if (power == 1) {
return value;
- else {
+ } else {
int result = 1;
for (int currentSub = 0; currentSub < power + 1; currentSub++) {
@@ -35,15 +37,18 @@ public class NumberUtils {
}
/**
- * Evaluates a linear probability distribution
+ * Evaluates a linear probability distribution.
*
* @param winning
- * The number of winning possibilities
+ * The number of winning possibilities.
+ *
* @param total
- * The number of total possibilities
+ * 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
+ * The function to use to generate a random possibility.
+ *
+ * @return Whether or not a random possibility was a winning one.
*/
public static boolean isProbable(final int winning, final int total, final Function<Integer, Integer> rng) {
return rng.apply(total) < winning;
@@ -53,15 +58,16 @@ public class NumberUtils {
* Check if a number is in an inclusive range.
*
* @param min
- * The minimum value of the range.
+ * The minimum value of the range.
*
* @param max
- * The maximum value of the range.
+ * The maximum value of the range.
*
* @param i
- * The number to check.
+ * The number to check.
*
- * @return Whether the number is in the range.
+ * @return
+ * Whether the number is in the range.
*/
public static boolean between(final int min, final int max, final int i) {
return i >= min && i <= max;