-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtility.java
More file actions
50 lines (49 loc) · 1.09 KB
/
Copy pathUtility.java
File metadata and controls
50 lines (49 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* Used for a few extraneous methods
*
* @AmarRuthen
* @5/25/21
*/
public class Utility
{
public Utility()
{
}
/**
* Returns a random integer up to the maximum value
* @param max Maximum value
* @return Random integer
*/
public int randomInteger(int max)
{
return (int)((max+1)*Math.random());
}
/**
* Returns a random integer from a minimum to a maximum value inclusive
* @param min Minimum value
* @param max Maximum value
* @return Random integer
*/
public int randomInteger(int min, int max)
{
return (int)((max+1)*Math.random()) + min;
}
/**
* Returns the floor of a double as an integer
* @param a The number to floor
* @return The floor of that number
*/
public int floor(double a)
{
return (int)(Math.floor(a));
}
/**
* Returns the ceiling of a double as an integer
* @param a The number to take the ceiling
* @return The ceiling of that number
*/
public int ceil(double a)
{
return (int)(Math.ceil(a));
}
}