Skip to content

Commit

Permalink
Replace Random instantiations with ThreadLocalRandom in FindCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
md5sha256 committed Nov 15, 2023
1 parent 95b4543 commit 23de684
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

@Singleton
public class FindCommand extends CommandAreaShop {
Expand Down Expand Up @@ -96,7 +97,7 @@ public void execute(CommandSender sender, String[] args) {
}
if(!results.isEmpty()) {
// Draw a random one
BuyRegion region = results.get(new Random().nextInt(results.size()));
BuyRegion region = results.get(ThreadLocalRandom.current().nextInt(results.size()));
Message onlyInGroup = Message.empty();
if(group != null) {
onlyInGroup = Message.fromKey("find-onlyInGroup").replacements(args[3]);
Expand Down Expand Up @@ -136,7 +137,7 @@ public void execute(CommandSender sender, String[] args) {
}
if(!results.isEmpty()) {
// Draw a random one
RentRegion region = results.get(new Random().nextInt(results.size()));
RentRegion region = results.get(ThreadLocalRandom.current().nextInt(results.size()));
Message onlyInGroup = Message.empty();
if(group != null) {
onlyInGroup = Message.fromKey("find-onlyInGroup").replacements(args[3]);
Expand Down

0 comments on commit 23de684

Please sign in to comment.