From 88a5952948e20fdf94534e4cafecce5bc5b0fdbb Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 28 Apr 2024 13:02:53 +0500 Subject: feat: percentFromValue method --- core/src/com/ilotterytea/maxoning/utils/math/Math.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core/src/com/ilotterytea/maxoning/utils') diff --git a/core/src/com/ilotterytea/maxoning/utils/math/Math.java b/core/src/com/ilotterytea/maxoning/utils/math/Math.java index 0bb8aa8..0c32a89 100644 --- a/core/src/com/ilotterytea/maxoning/utils/math/Math.java +++ b/core/src/com/ilotterytea/maxoning/utils/math/Math.java @@ -10,4 +10,8 @@ public class Math { public static int getRandomNumber(int min, int max) { return (int) ((java.lang.Math.random() * (max - min)) + min); } + + public static float percentFromValue(float percentage, int value) { + return percentage / 100f * value; + } } -- cgit v1.2.3