mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-12 13:53:54 +00:00
Replaced All Instances of Random With SplittableRandom
SplittableRandom is faster (negligable) than Random and is also able to recursively return new instances of itself for an even more complex pseudo random generator compared to the default Random supplied by Java.
This commit is contained in:
@ -2,7 +2,7 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.SplittableRandom;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
@ -27,7 +27,7 @@ public class Command_bird extends FreedomCommand
|
||||
public EntityType getRandomFish()
|
||||
{
|
||||
List<EntityType> fishTypes = Arrays.asList(EntityType.COD, EntityType.SALMON, EntityType.PUFFERFISH, EntityType.TROPICAL_FISH);
|
||||
Random random = new Random();
|
||||
SplittableRandom random = new SplittableRandom();
|
||||
return fishTypes.get(random.nextInt(fishTypes.size()));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.SplittableRandom;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
@ -15,7 +15,7 @@ public class Command_deafen extends FreedomCommand
|
||||
{
|
||||
|
||||
public static final double STEPS = 10.0;
|
||||
private static final Random random = new Random();
|
||||
private static final SplittableRandom random = new SplittableRandom();
|
||||
|
||||
private static Location randomOffset(Location a)
|
||||
{
|
||||
|
@ -2,7 +2,7 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.SplittableRandom;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.minecraft.server.v1_16_R3.NBTTagCompound;
|
||||
@ -180,7 +180,7 @@ public class Command_modifyitem extends FreedomCommand
|
||||
}
|
||||
cmpnd.setDouble("Amount", amount);
|
||||
cmpnd.setInt("Operation", 0);
|
||||
Random random = new Random();
|
||||
SplittableRandom random = new SplittableRandom();
|
||||
cmpnd.setIntArray("UUID", new int[]
|
||||
{
|
||||
random.nextInt(),
|
||||
|
Reference in New Issue
Block a user