mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
fix for the RandomUtil, always use .current() to get the correct thread.
This commit is contained in:
parent
5289dd3df8
commit
e62241c3eb
1 changed files with 4 additions and 7 deletions
|
@ -8,21 +8,18 @@ import java.util.concurrent.ThreadLocalRandom;
|
|||
*/
|
||||
public class RandomUtil {
|
||||
|
||||
private final static ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||
|
||||
public static Random getRandom() {
|
||||
return random;
|
||||
}
|
||||
public static Random getRandom() {return ThreadLocalRandom.current();}
|
||||
|
||||
public static int nextInt() {
|
||||
return random.nextInt();
|
||||
return ThreadLocalRandom.current().nextInt();
|
||||
}
|
||||
|
||||
public static int nextInt(int max) {
|
||||
return random.nextInt(max);
|
||||
return ThreadLocalRandom.current().nextInt(max);
|
||||
}
|
||||
|
||||
public static boolean nextBoolean() {
|
||||
return random.nextBoolean();
|
||||
return ThreadLocalRandom.current().nextBoolean();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue