![JAR search and dependency download from the Maven repository](/logo.png)
io.nextop.client.retry.RandomSequence Maven / Gradle / Ivy
package io.nextop.client.retry;
import java.util.Random;
final class RandomSequence {
static RandomSequence create(Random r) {
int value;
synchronized (r) {
value = r.nextInt(Integer.MAX_VALUE);
}
return new RandomSequence(value, r);
}
private final int value;
private final Random r;
private RandomSequence(int value, Random r) {
this.value = value;
this.r = r;
}
public int intValue() {
return value;
}
public float floatValue() {
return (float) ((double) value / Integer.MAX_VALUE);
}
public RandomSequence next() {
return create(r);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy