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:
Paldiu
2020-12-25 15:57:10 -05:00
parent dec35f76e4
commit eb9759f2d8
8 changed files with 18 additions and 18 deletions

View File

@ -5,7 +5,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import java.util.SplittableRandom;
import java.util.UUID;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
@ -48,7 +48,7 @@ import org.bukkit.util.Vector;
public class ItemFun extends FreedomService
{
private final Random random = new Random();
private final SplittableRandom random = new SplittableRandom();
private final Map<String, List<String>> cooldownTracker = new HashMap<>();
private final Map<Player, Float> orientationTracker = new HashMap<>();
private final List<UUID> FIRE_BALL_UUIDS = new ArrayList<>();

View File

@ -2,7 +2,7 @@ package me.totalfreedom.totalfreedommod.fun;
import java.util.HashSet;
import java.util.Objects;
import java.util.Random;
import java.util.SplittableRandom;
import java.util.Set;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.util.Groups;
@ -17,7 +17,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
public class Trailer extends FreedomService
{
private final Random random = new Random();
private final SplittableRandom random = new SplittableRandom();
private final Set<String> trailPlayers = new HashSet<>(); // player name
@Override