Class MathUtils

java.lang.Object
xyz.xenondevs.particle.utils.MathUtils

public final class MathUtils extends Object
Utility for Maths
Since:
14.09.2018
Author:
ByteZ
  • Field Details

    • RANDOM

      public static final Random RANDOM
      An easy to access Random implementation for random number generation. This specific field is mostly used by the random methods of the ParticleData types.
  • Constructor Details

    • MathUtils

      public MathUtils()
  • Method Details

    • generateRandomInteger

      public static int generateRandomInteger(int minimum, int maximum)
      Generates a random Integer.
      Parameters:
      minimum - the minimum value of the generated value.
      maximum - the maximum value of the generated value.
      Returns:
      a randomly generated Integer in the defined range.
      See Also:
    • getMaxOrMin

      public static int getMaxOrMin(int value, int max, int min)
      Checks if a specific Integer is in the given range. If not the respective bound of the range is returned.
      Parameters:
      value - the value which should be checked.
      max - the maximum value.
      min - the minimum value
      Returns:
      the calculated value.