CPD Results
The following document contains the results of PMD's CPD 7.2.0.
Duplications
File |
Line |
org/apache/commons/rng/core/source64/L128X1024Mix.java |
103 |
org/apache/commons/rng/core/source64/L64X1024Mix.java |
103 |
protected L128X1024Mix(L128X1024Mix source) {
super(source);
System.arraycopy(source.x, 0, x, 0, XBG_STATE_SIZE);
index = source.index;
}
/** {@inheritDoc} */
@Override
protected byte[] getStateInternal() {
final long[] s = new long[XBG_STATE_SIZE + 1];
System.arraycopy(x, 0, s, 0, XBG_STATE_SIZE);
s[XBG_STATE_SIZE] = index;
return composeStateInternal(NumberFactory.makeByteArray(s),
super.getStateInternal());
}
/** {@inheritDoc} */
@Override
protected void setStateInternal(byte[] s) {
final byte[][] c = splitStateInternal(s, (XBG_STATE_SIZE + 1) * Long.BYTES);
final long[] tmp = NumberFactory.makeLongArray(c[0]);
System.arraycopy(tmp, 0, x, 0, XBG_STATE_SIZE);
index = (int) tmp[XBG_STATE_SIZE];
super.setStateInternal(c[1]);
}
/** {@inheritDoc} */
@Override
public long next() {
// LXM generate.
// Old state is used for the output allowing parallel pipelining
// on processors that support multiple concurrent instructions.
final int q = index;
index = (q + 1) & 15;
final long s0 = x[index];
long s15 = x[q];
final long sh = lsh; |
File |
Line |
org/apache/commons/rng/core/source64/AbstractXoRoShiRo1024.java |
76 |
org/apache/commons/rng/core/source64/XorShift1024Star.java |
90 |
index = source.index;
}
/** {@inheritDoc} */
@Override
protected byte[] getStateInternal() {
final long[] s = Arrays.copyOf(state, SEED_SIZE + 1);
s[SEED_SIZE] = index;
return composeStateInternal(NumberFactory.makeByteArray(s),
super.getStateInternal());
}
/** {@inheritDoc} */
@Override
protected void setStateInternal(byte[] s) {
final byte[][] c = splitStateInternal(s, (SEED_SIZE + 1) * 8);
final long[] tmp = NumberFactory.makeLongArray(c[0]);
System.arraycopy(tmp, 0, state, 0, SEED_SIZE);
index = (int) tmp[SEED_SIZE];
super.setStateInternal(c[1]);
}
/**
* Seeds the RNG.
*
* @param seed Seed.
*/
private void setSeedInternal(long[] seed) {
// Reset the whole state of this RNG (i.e. "state" and "index").
// Filling procedure is not part of the reference code.
fillState(state, seed);
index = 0;
}
/** {@inheritDoc} */
@Override
public long next() {
final int q = index; |
File |
Line |
org/apache/commons/rng/core/source64/L128X256Mix.java |
133 |
org/apache/commons/rng/core/source64/L64X256Mix.java |
131 |
protected L128X256Mix(L128X256Mix source) {
super(source);
x0 = source.x0;
x1 = source.x1;
x2 = source.x2;
x3 = source.x3;
}
/** {@inheritDoc} */
@Override
protected byte[] getStateInternal() {
return composeStateInternal(NumberFactory.makeByteArray(
new long[] {x0, x1, x2, x3}),
super.getStateInternal());
}
/** {@inheritDoc} */
@Override
protected void setStateInternal(byte[] s) {
final byte[][] c = splitStateInternal(s, XBG_STATE_SIZE * Long.BYTES);
final long[] tmp = NumberFactory.makeLongArray(c[0]);
x0 = tmp[0];
x1 = tmp[1];
x2 = tmp[2];
x3 = tmp[3];
super.setStateInternal(c[1]);
}
/** {@inheritDoc} */
@Override
public long next() {
// LXM generate.
// Old state is used for the output allowing parallel pipelining
// on processors that support multiple concurrent instructions.
long s0 = x0;
final long sh = lsh; |
File |
Line |
org/apache/commons/rng/core/source64/AbstractL64X128.java |
90 |
org/apache/commons/rng/core/source64/L128X128Mix.java |
123 |
AbstractL64X128(AbstractL64X128 source) {
super(source);
x0 = source.x0;
x1 = source.x1;
}
/** {@inheritDoc} */
@Override
protected byte[] getStateInternal() {
return composeStateInternal(NumberFactory.makeByteArray(
new long[] {x0, x1}),
super.getStateInternal());
}
/** {@inheritDoc} */
@Override
protected void setStateInternal(byte[] s) {
final byte[][] c = splitStateInternal(s, XBG_STATE_SIZE * Long.BYTES);
final long[] tmp = NumberFactory.makeLongArray(c[0]);
x0 = tmp[0];
x1 = tmp[1];
super.setStateInternal(c[1]);
}
/**
* {@inheritDoc}
*
* <p>The jump size is the equivalent of moving the state <em>backwards</em> by
* (2<sup>128</sup> - 1) positions. It can provide up to 2<sup>64</sup>
* non-overlapping subsequences.
*/
@Override
public UniformRandomProvider jump() { |
File |
Line |
org/apache/commons/rng/core/source32/AbstractPcg6432.java |
145 |
org/apache/commons/rng/core/source64/PcgRxsMXs64.java |
115 |
@Override
protected byte[] getStateInternal() {
// The increment is divided by 2 before saving.
// This transform is used in the reference PCG code; it prevents restoring from
// a byte state a non-odd increment that results in a sub-maximal period generator.
return composeStateInternal(NumberFactory.makeByteArray(
new long[] {state, increment >>> 1}),
super.getStateInternal());
}
/** {@inheritDoc} */
@Override
protected void setStateInternal(byte[] s) {
final byte[][] c = splitStateInternal(s, SEED_SIZE * 8);
final long[] tempseed = NumberFactory.makeLongArray(c[0]);
state = tempseed[0];
// Reverse the transform performed during getState to make the increment odd again.
increment = tempseed[1] << 1 | 1;
super.setStateInternal(c[1]);
}
} |
File |
Line |
org/apache/commons/rng/core/source32/AbstractPcg6432.java |
96 |
org/apache/commons/rng/core/source64/PcgRxsMXs64.java |
74 |
AbstractPcg6432(long[] seed) {
if (seed.length < SEED_SIZE) {
final long[] tmp = new long[SEED_SIZE];
fillState(tmp, seed);
setSeedInternal(tmp);
} else {
setSeedInternal(seed);
}
}
/**
* Seeds the RNG.
*
* @param seed Seed.
*/
private void setSeedInternal(long[] seed) {
// Ensure the increment is odd to provide a maximal period LCG.
this.increment = (seed[1] << 1) | 1;
this.state = bump(seed[0] + this.increment);
}
/**
* Provides the next state of the LCG.
*
* @param input Current state.
* @return next state
*/
private long bump(long input) {
return input * 6364136223846793005L + increment;
}
/** {@inheritDoc} */
@Override
public int next() { |
|