Some code formatting.
This commit is contained in:
@ -40,19 +40,19 @@ public final class Rnd
|
||||
this(++SEED_UNIQUIFIER + System.nanoTime());
|
||||
}
|
||||
|
||||
public NonAtomicRandom(final long seed)
|
||||
public NonAtomicRandom(long seed)
|
||||
{
|
||||
setSeed(seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int next(final int bits)
|
||||
public final int next(int bits)
|
||||
{
|
||||
return (int) ((_seed = ((_seed * MULTIPLIER) + ADDEND) & MASK) >>> (48 - bits));
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setSeed(final long seed)
|
||||
public final void setSeed(long seed)
|
||||
{
|
||||
_seed = (seed ^ MULTIPLIER) & MASK;
|
||||
}
|
||||
@ -65,7 +65,7 @@ public final class Rnd
|
||||
{
|
||||
private final Random _random;
|
||||
|
||||
protected RandomContainer(final Random random)
|
||||
protected RandomContainer(Random random)
|
||||
{
|
||||
_random = random;
|
||||
}
|
||||
@ -90,7 +90,7 @@ public final class Rnd
|
||||
* @param n The superior limit (exclusive)
|
||||
* @return A random integer number from 0 to n-1
|
||||
*/
|
||||
public final int get(final int n)
|
||||
public final int get(int n)
|
||||
{
|
||||
return (int) (_random.nextDouble() * n);
|
||||
}
|
||||
@ -101,7 +101,7 @@ public final class Rnd
|
||||
* @param max The maximum value
|
||||
* @return A random integer number from min to max
|
||||
*/
|
||||
public final int get(final int min, final int max)
|
||||
public final int get(int min, int max)
|
||||
{
|
||||
return min + (int) (_random.nextDouble() * ((max - min) + 1));
|
||||
}
|
||||
@ -112,7 +112,7 @@ public final class Rnd
|
||||
* @param max The maximum value
|
||||
* @return A random long number from min to max
|
||||
*/
|
||||
public final long get(final long min, final long max)
|
||||
public final long get(long min, long max)
|
||||
{
|
||||
return min + (long) (_random.nextDouble() * ((max - min) + 1));
|
||||
}
|
||||
@ -132,7 +132,7 @@ public final class Rnd
|
||||
* @param array The array to be filled with random byte numbers
|
||||
* @see java.util.Random#nextBytes(byte[] bytes)
|
||||
*/
|
||||
public final void nextBytes(final byte[] array)
|
||||
public final void nextBytes(byte[] array)
|
||||
{
|
||||
_random.nextBytes(array);
|
||||
}
|
||||
@ -235,17 +235,17 @@ public final class Rnd
|
||||
{
|
||||
long _seed;
|
||||
|
||||
Seed(final long seed)
|
||||
Seed(long seed)
|
||||
{
|
||||
setSeed(seed);
|
||||
}
|
||||
|
||||
final int next(final int bits)
|
||||
final int next(int bits)
|
||||
{
|
||||
return (int) ((_seed = ((_seed * MULTIPLIER) + ADDEND) & MASK) >>> (48 - bits));
|
||||
}
|
||||
|
||||
final void setSeed(final long seed)
|
||||
final void setSeed(long seed)
|
||||
{
|
||||
_seed = (seed ^ MULTIPLIER) & MASK;
|
||||
}
|
||||
@ -265,7 +265,7 @@ public final class Rnd
|
||||
};
|
||||
}
|
||||
|
||||
public ThreadLocalRandom(final long seed)
|
||||
public ThreadLocalRandom(long seed)
|
||||
{
|
||||
_seedLocal = new ThreadLocal<Seed>()
|
||||
{
|
||||
@ -278,13 +278,13 @@ public final class Rnd
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int next(final int bits)
|
||||
public final int next(int bits)
|
||||
{
|
||||
return _seedLocal.get().next(bits);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setSeed(final long seed)
|
||||
public final void setSeed(long seed)
|
||||
{
|
||||
if (_seedLocal != null)
|
||||
{
|
||||
@ -323,7 +323,7 @@ public final class Rnd
|
||||
* @param n The superior limit (exclusive)
|
||||
* @return A random integer number from 0 to n-1
|
||||
*/
|
||||
public static final int get(final int n)
|
||||
public static final int get(int n)
|
||||
{
|
||||
return rnd.get(n);
|
||||
}
|
||||
@ -334,7 +334,7 @@ public final class Rnd
|
||||
* @param max The maximum value
|
||||
* @return A random integer number from min to max
|
||||
*/
|
||||
public static final int get(final int min, final int max)
|
||||
public static final int get(int min, int max)
|
||||
{
|
||||
return rnd.get(min, max);
|
||||
}
|
||||
@ -345,12 +345,12 @@ public final class Rnd
|
||||
* @param max The maximum value
|
||||
* @return A random long number from min to max
|
||||
*/
|
||||
public static final long get(final long min, final long max)
|
||||
public static final long get(long min, long max)
|
||||
{
|
||||
return rnd.get(min, max);
|
||||
}
|
||||
|
||||
public static final RandomContainer newInstance(final RandomType type)
|
||||
public static final RandomContainer newInstance(RandomType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@ -390,7 +390,7 @@ public final class Rnd
|
||||
* @param array The array to be filled with random byte numbers
|
||||
* @see java.util.Random#nextBytes(byte[] bytes)
|
||||
*/
|
||||
public static final void nextBytes(final byte[] array)
|
||||
public static final void nextBytes(byte[] array)
|
||||
{
|
||||
rnd.nextBytes(array);
|
||||
}
|
||||
@ -440,7 +440,7 @@ public final class Rnd
|
||||
* @return
|
||||
* @see com.l2jmobius.util.Rnd#get(int n)
|
||||
*/
|
||||
public static final int nextInt(final int n)
|
||||
public static final int nextInt(int n)
|
||||
{
|
||||
return get(n);
|
||||
}
|
||||
|
Reference in New Issue
Block a user