|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.brackeen.javagamebook.util.MoreMath
The MoreMath class provides functions not contained in the java.lang.Math or java.lang.StrictMath classes.
Constructor Summary | |
MoreMath()
|
Method Summary | |
static int |
ceil(float f)
Faster ceil function to convert a float to an int. |
static boolean |
chance(float p)
Returns true if a random "event" occurs. |
static int |
floor(float f)
Faster floor function to convert a float to an int. |
static int |
getBitCount(int n)
Gets the number of "on" bits in an integer. |
static boolean |
isPowerOfTwo(int n)
Returns true if the specified number is a power of 2. |
static float |
random(float max)
Returns a random float from 0 to max (inclusive). |
static float |
random(float min,
float max)
Returns a random float from min to max (inclusive). |
static int |
random(int max)
Returns a random integer from 0 to max (inclusive). |
static int |
random(int min,
int max)
Returns a random integer from min to max (inclusive). |
static java.lang.Object |
random(java.util.List list)
Returns a random object from a List. |
static int |
sign(double v)
Returns the sign of the number. |
static int |
sign(float v)
Returns the sign of the number. |
static int |
sign(int v)
Returns the sign of the number. |
static int |
sign(long v)
Returns the sign of the number. |
static int |
sign(short v)
Returns the sign of the number. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MoreMath()
Method Detail |
public static int sign(short v)
public static int sign(int v)
public static int sign(long v)
public static int sign(float v)
public static int sign(double v)
public static int ceil(float f)
public static int floor(float f)
public static int random(int max)
public static int random(int min, int max)
public static float random(float max)
public static float random(float min, float max)
public static java.lang.Object random(java.util.List list)
public static boolean chance(float p)
public static boolean isPowerOfTwo(int n)
public static int getBitCount(int n)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |