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

@ -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()));
}
}