From 27bf571d6413c3cc6a5d664b5bddd38d21d7b1cd Mon Sep 17 00:00:00 2001 From: EVE Date: Mon, 13 Mar 2017 16:42:21 -0400 Subject: Formatting --- .../main/java/bjc/utils/gen/WeightedRandom.java | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/gen/WeightedRandom.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/gen/WeightedRandom.java b/BJC-Utils2/src/main/java/bjc/utils/gen/WeightedRandom.java index 2df820c..d5256ee 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/gen/WeightedRandom.java +++ b/BJC-Utils2/src/main/java/bjc/utils/gen/WeightedRandom.java @@ -9,46 +9,45 @@ import bjc.utils.funcdata.FunctionalList; import bjc.utils.funcdata.IList; /** - * Represents a random number generator where certain results are weighted - * more heavily than others. + * Represents a random number generator where certain results are weighted more + * heavily than others. * * @author ben * * @param - * The type of values that are randomly selected. + * The type of values that are randomly selected. */ public class WeightedRandom { /* * The list of probabilities for each result */ - private IList probabilities; + private IList probabilities; /* * The list of possible results to pick from */ - private IList results; + private IList results; /* * The source for any needed random numbers */ - private Random source; + private Random source; - private int totalChance; + private int totalChance; /** * Create a new weighted random generator with the specified source of * randomness * * @param src - * The source of randomness to use. + * The source of randomness to use. */ public WeightedRandom(Random src) { probabilities = new FunctionalList<>(); results = new FunctionalList<>(); if (src == null) { - throw new NullPointerException( - "Source of randomness must not be null"); + throw new NullPointerException("Source of randomness must not be null"); } source = src; @@ -58,9 +57,9 @@ public class WeightedRandom { * Add a probability for a specific result to be given. * * @param chance - * The chance to get this result. + * The chance to get this result. * @param result - * The result to get when the chance comes up. + * The result to get when the chance comes up. */ public void addProbability(int chance, E result) { probabilities.add(chance); @@ -104,8 +103,8 @@ public class WeightedRandom { } /** - * Return a list containing values that can be generated paired with - * the probability of those values being generated + * Return a list containing values that can be generated paired with the + * probability of those values being generated * * @return A list of pairs of values and value probabilities */ -- cgit v1.2.3