Made ConstantGenerator public and constant value configurable.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1152659 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2011-07-31 22:51:35 +00:00
parent 1bc6cbd731
commit 7b4c168854
1 changed files with 17 additions and 7 deletions

View File

@ -58,7 +58,17 @@ public class RandomAdaptorTest {
* "Powered by Eclipse ;-)"
*
*/
private static class ConstantGenerator implements RandomGenerator {
public static class ConstantGenerator implements RandomGenerator {
private final double value;
public ConstantGenerator() {
value = 0;
}
public ConstantGenerator(double value) {
this.value = value;
}
public boolean nextBoolean() {
return false;
@ -68,27 +78,27 @@ public class RandomAdaptorTest {
}
public double nextDouble() {
return 0;
return value;
}
public float nextFloat() {
return 0;
return (float) value;
}
public double nextGaussian() {
return 0;
return value;
}
public int nextInt() {
return 0;
return (int) value;
}
public int nextInt(int n) {
return 0;
return (int) value;
}
public long nextLong() {
return 0;
return (int) value;
}
public void setSeed(int seed) {