diff --git a/src/java/org/apache/commons/lang/math/LongRange.java b/src/java/org/apache/commons/lang/math/LongRange.java index b07412c95..7ba03be52 100644 --- a/src/java/org/apache/commons/lang/math/LongRange.java +++ b/src/java/org/apache/commons/lang/math/LongRange.java @@ -60,7 +60,7 @@ * * @author Stephen Colebourne * @since 2.0 - * @version $Id: LongRange.java,v 1.5 2003/08/18 02:22:24 bayard Exp $ + * @version $Id: LongRange.java,v 1.6 2003/12/29 00:58:27 ggregory Exp $ */ public final class LongRange extends Range implements Serializable { @@ -264,9 +264,11 @@ public long getMaximumLong() { } /** - *
Gets the maximum number in this range as a int
.
Gets the maximum number in this range cast to an int
.
This conversion can lose information for large values.
+ * + * @return the maximum number in this range cast to anint
.
*/
public int getMaximumInteger() {
return (int) max;
diff --git a/src/java/org/apache/commons/lang/math/RandomUtils.java b/src/java/org/apache/commons/lang/math/RandomUtils.java
index 084a3b483..d7a7fc307 100644
--- a/src/java/org/apache/commons/lang/math/RandomUtils.java
+++ b/src/java/org/apache/commons/lang/math/RandomUtils.java
@@ -61,11 +61,15 @@
* method and its system-wide Random
object.
*
* @author Henri Yandell
+ * @author Gary D. Gregory
* @since 2.0
- * @version $Id: RandomUtils.java,v 1.6 2003/08/18 02:22:24 bayard Exp $
+ * @version $Id: RandomUtils.java,v 1.7 2003/12/29 00:58:27 ggregory Exp $
*/
public class RandomUtils {
+ /**
+ * An instance of {@link JVMRandom}.
+ */
public static final Random JVM_RANDOM = new JVMRandom();
// should be possible for JVM_RANDOM?
@@ -82,25 +86,44 @@ public class RandomUtils {
public static int nextInt() {
return nextInt(JVM_RANDOM);
}
- public static int nextInt(Random rnd) {
- return rnd.nextInt();
+
+ /**
+ * Returns the next pseudorandom, uniformly distributed int value
+ * from the given random
sequence.
Returns a pseudorandom, uniformly distributed int value
* between 0
(inclusive) and the specified value
* (exclusive), from the Math.random() sequence.
Returns a pseudorandom, uniformly distributed int value
+ * between 0
(inclusive) and the specified value
+ * (exclusive), from the given Random sequence.
Returns the next pseudorandom, uniformly distributed long value * from the Math.random() sequence.
@@ -110,9 +133,18 @@ public static int nextInt(Random rnd, int n) { public static long nextLong() { return nextLong(JVM_RANDOM); } - public static long nextLong(Random rnd) { - return rnd.nextLong(); + + /** + *Returns the next pseudorandom, uniformly distributed long value + * from the given Random sequence.
+ * + * @param random the Random sequence generator. + * @return the random long + */ + public static long nextLong(Random random) { + return random.nextLong(); } + /** *Returns the next pseudorandom, uniformly distributed boolean value * from the Math.random() sequence.
@@ -122,9 +154,18 @@ public static long nextLong(Random rnd) { public static boolean nextBoolean() { return nextBoolean(JVM_RANDOM); } - public static boolean nextBoolean(Random rnd) { - return rnd.nextBoolean(); + + /** + *Returns the next pseudorandom, uniformly distributed boolean value + * from the given random sequence.
+ * + * @param random the Random sequence generator. + * @return the random boolean + */ + public static boolean nextBoolean(Random random) { + return random.nextBoolean(); } + /** *Returns the next pseudorandom, uniformly distributed float value
* between 0.0
and 1.0
from the Math.random()
@@ -135,19 +176,40 @@ public static boolean nextBoolean(Random rnd) {
public static float nextFloat() {
return nextFloat(JVM_RANDOM);
}
- public static float nextFloat(Random rnd) {
- return rnd.nextFloat();
- }
+
/**
- *
Synonymous to the Math.random() call.
+ *Returns the next pseudorandom, uniformly distributed float value
+ * between 0.0
and 1.0
from the given Random
+ * sequence.
Returns the next pseudorandom, uniformly distributed float value
+ * between 0.0
and 1.0
from the Math.random()
+ * sequence.
Returns the next pseudorandom, uniformly distributed float value
+ * between 0.0
and 1.0
from the given Random
+ * sequence.