@@ -78,13 +78,13 @@ public static BedwarsPlayerStats generateFake(String name) {
7878 int star = (int ) getGaussian (random , 150 , 30 );
7979 double fkdr = Math .min (getGaussian (random , 1.3F , 0.5F ), 0.6F );
8080 double bblr = (fkdr * 8 ) / getGaussian (random , 10 , 2 );
81- int wins = (int ) (star * (fkdr * 4 ) * random . nextFloat ( 0.95F , 1.05F ));
82- int losses = (int ) (wins * (2 /fkdr ) * random . nextFloat ( 0.95F , 1.05F ));
81+ int wins = (int ) (star * (fkdr * 4 ) * getFloat ( random , 0.95F , 1.05F ));
82+ int losses = (int ) (wins * (2 /fkdr ) * getFloat ( random , 0.95F , 1.05F ));
8383 int beds = (int ) (bblr * losses );
84- int finalDeaths = (int ) (losses * random . nextFloat ( 1F , 1.03F ));
85- int deaths = (int ) (finalDeaths * random . nextFloat ( 8 , 20 ));
84+ int finalDeaths = (int ) (losses * getFloat ( random , 1F , 1.03F ));
85+ int deaths = (int ) (finalDeaths * getFloat ( random , 8 , 20 ));
8686 int finalKills = (int ) (deaths * fkdr );
87- int kills = (int ) (finalKills * random . nextFloat ( 1 , 2 ));
87+ int kills = (int ) (finalKills * getFloat ( random , 1 , 2 ));
8888
8989 return new BedwarsPlayerStats (finalKills , finalDeaths , beds , deaths , kills ,
9090 0 , 0 , 0 , 0 , 0 ,
@@ -95,6 +95,10 @@ private static double getGaussian(Random random, float mean, float deviation){
9595 return Math .max (Math .min (random .nextGaussian ()*deviation +mean , mean - deviation *3 ), mean + deviation *3 );
9696 }
9797
98+ private static float getFloat (Random random , float origin , float bound ){
99+ return random .nextFloat ()*(bound - origin )+origin ;
100+ }
101+
98102 @ Nullable
99103 public static BedwarsPlayerStats fromAPI (String uuid ) {
100104 JsonElement rawStats = HypixelAbstractionLayer .getPlayerProperty (uuid , "stats" );
0 commit comments