Deprecate static RandomUtils.next*() methods in favor or .secure() and

.insecure() versions
This commit is contained in:
Gary Gregory 2024-08-08 07:24:43 -04:00
parent 956c795f29
commit f3de6a4633
2 changed files with 24 additions and 0 deletions

View File

@ -46,6 +46,8 @@ The <action> type attribute can be add,update,fix,remove.
</properties>
<body>
<release version="3.16.1" date="YYYY-MM-DD" description="This is a feature and maintenance release. Java 8 or later is required.">
<!-- FIX -->
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate static RandomUtils.next*() methods in favor or .secure() and .insecure() versions.</action>
<!-- ADD -->
<action type="add" dev="ggregory" due-to="Gary Gregory">Make RandomUtils.insecure() public.</action>
<!-- UPDATE -->

View File

@ -92,7 +92,9 @@ public class RandomUtils {
*
* @return the random boolean
* @since 3.5
* @deprecated Use {@link #secure()} or {@link #insecure()}.
*/
@Deprecated
public static boolean nextBoolean() {
return secure().randomBoolean();
}
@ -103,7 +105,9 @@ public class RandomUtils {
* @param count the size of the returned array
* @return the random byte array
* @throws IllegalArgumentException if {@code count} is negative
* @deprecated Use {@link #secure()} or {@link #insecure()}.
*/
@Deprecated
public static byte[] nextBytes(final int count) {
return secure().randomBytes(count);
}
@ -114,7 +118,9 @@ public class RandomUtils {
* @return the random double
* @see #nextDouble(double, double)
* @since 3.5
* @deprecated Use {@link #secure()} or {@link #insecure()}.
*/
@Deprecated
public static double nextDouble() {
return secure().randomDouble();
}
@ -127,7 +133,9 @@ public class RandomUtils {
* @throws IllegalArgumentException if {@code startInclusive > endExclusive} or if {@code startInclusive} is
* negative
* @return the random double
* @deprecated Use {@link #secure()} or {@link #insecure()}.
*/
@Deprecated
public static double nextDouble(final double startInclusive, final double endExclusive) {
return secure().randomDouble(startInclusive, endExclusive);
}
@ -138,7 +146,9 @@ public class RandomUtils {
* @return the random float
* @see #nextFloat(float, float)
* @since 3.5
* @deprecated Use {@link #secure()} or {@link #insecure()}.
*/
@Deprecated
public static float nextFloat() {
return secure().randomFloat();
}
@ -151,7 +161,9 @@ public class RandomUtils {
* @throws IllegalArgumentException if {@code startInclusive > endExclusive} or if {@code startInclusive} is
* negative
* @return the random float
* @deprecated Use {@link #secure()} or {@link #insecure()}.
*/
@Deprecated
public static float nextFloat(final float startInclusive, final float endExclusive) {
return secure().randomFloat(startInclusive, endExclusive);
}
@ -162,7 +174,9 @@ public class RandomUtils {
* @return the random integer
* @see #nextInt(int, int)
* @since 3.5
* @deprecated Use {@link #secure()} or {@link #insecure()}.
*/
@Deprecated
public static int nextInt() {
return secure().randomInt();
}
@ -175,7 +189,9 @@ public class RandomUtils {
* @throws IllegalArgumentException if {@code startInclusive > endExclusive} or if {@code startInclusive} is
* negative
* @return the random integer
* @deprecated Use {@link #secure()} or {@link #insecure()}.
*/
@Deprecated
public static int nextInt(final int startInclusive, final int endExclusive) {
return secure().randomInt(startInclusive, endExclusive);
}
@ -186,7 +202,9 @@ public class RandomUtils {
* @return the random long
* @see #nextLong(long, long)
* @since 3.5
* @deprecated Use {@link #secure()} or {@link #insecure()}.
*/
@Deprecated
public static long nextLong() {
return secure().randomLong();
}
@ -196,7 +214,9 @@ public class RandomUtils {
*
* @param n Bound on the random number to be returned. Must be positive.
* @return a random {@code long} value between 0 (inclusive) and {@code n} (exclusive).
* @deprecated Use {@link #secure()} or {@link #insecure()}.
*/
@Deprecated
private static long nextLong(final long n) {
return secure().randomLong(n);
}
@ -209,7 +229,9 @@ public class RandomUtils {
* @throws IllegalArgumentException if {@code startInclusive > endExclusive} or if {@code startInclusive} is
* negative
* @return the random long
* @deprecated Use {@link #secure()} or {@link #insecure()}.
*/
@Deprecated
public static long nextLong(final long startInclusive, final long endExclusive) {
return secure().randomLong(startInclusive, endExclusive);
}