File tree Expand file tree Collapse file tree 2 files changed +15
-13
lines changed
src/main/java/me/dkim19375/dkim19375core Expand file tree Collapse file tree 2 files changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,12 @@ plugins {
22 id ' java'
33}
44
5+ // noinspection GroovyUnusedAssignment
6+ sourceCompatibility = targetCompatibility = JavaVersion . VERSION_1_8
7+ compileJava. options. encoding ' UTF-8'
8+
59group ' me.dkim19375'
6- version ' 2.3.2 '
10+ version ' 2.3.3 '
711
812repositories {
913 mavenCentral()
Original file line number Diff line number Diff line change 11package me .dkim19375 .dkim19375core ;
22
3+ import java .util .Random ;
4+
35public class NumberUtils {
4- public static long getPercentage (long lower , long max ) {
5- return (lower * 100 ) / max ;
6- }
6+ private final static Random random = new Random ();
7+
8+ public static long getPercentage (long lower , long max ) { return (lower * 100 ) / max ; }
9+
10+ public static double getPercentageDouble (double lower , double max ) { return (lower * 100 ) / max ; }
711
8- public static double getPercentageDouble (double lower , double max ) {
9- return (lower * 100 ) / max ;
10- }
12+ public static boolean percentChance (float chance ) { return Math .random () * 100 <= chance ; }
1113
12- public static boolean percentChance (float chance ) {
13- return Math .random () * 100 <= chance ;
14- }
14+ public static boolean percentChance (int chance ) { return Math .random () * 100 <= chance ; }
1515
16- public static boolean percentChance (int chance ) {
17- return Math .random () * 100 <= chance ;
18- }
16+ public static int getRandomNumber (int minimum , int maximum ) { return random .nextInt (maximum - minimum + 1 ) + maximum ; }
1917}
You can’t perform that action at this time.
0 commit comments