Class MathUtil
java.lang.Object
net.rodofire.easierworldcreator.util.MathUtil
util math class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleangetRandomBoolean(float chance) method to get a random booleanstatic intmethod to get a random opposite with a 50% chancestatic intgetRandomOpposite(float chance) method to get a random opposite with the wanted chancestatic intgetSign(double a) method to get the sign of a numberstatic intgetSign(float a) method to get the sign of a numberstatic intgetSign(int a) method to get the sign of a number
-
Constructor Details
-
MathUtil
public MathUtil()
-
-
Method Details
-
getRandomOpposite
public static int getRandomOpposite()method to get a random opposite with a 50% chance- Returns:
- a random opposite
-
getRandomOpposite
public static int getRandomOpposite(float chance) method to get a random opposite with the wanted chance- Parameters:
chance- the chance of -1 being selected- Returns:
- a random opposite
-
getRandomBoolean
public static boolean getRandomBoolean(float chance) method to get a random boolean- Parameters:
chance- the chance of true being selected- Returns:
- the random boolean
-
getSign
public static int getSign(int a) method to get the sign of a number- Parameters:
a- the int to compare- Returns:
- the sign of the int
-
getSign
public static int getSign(double a) method to get the sign of a number- Parameters:
a- the double to compare- Returns:
- the sign of the double
-
getSign
public static int getSign(float a) method to get the sign of a number- Parameters:
a- the float to compare- Returns:
- the sign of the float
-