You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2016/08/17 10:39:50 UTC
[2/2] commons-rng git commit: Formatting.
Formatting.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/dbf0756a
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/dbf0756a
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/dbf0756a
Branch: refs/heads/master
Commit: dbf0756aae17b7e70b38672d088437a853858cfa
Parents: d55ae2f
Author: Gilles <er...@apache.org>
Authored: Wed Aug 17 14:38:10 2016 +0200
Committer: Gilles <er...@apache.org>
Committed: Wed Aug 17 14:38:10 2016 +0200
----------------------------------------------------------------------
.../rng/internal/source32/MersenneTwister.java | 18 +++++++++---------
.../rng/internal/util/IntArray2LongArray.java | 2 +-
2 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/dbf0756a/src/main/java/org/apache/commons/rng/internal/source32/MersenneTwister.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/rng/internal/source32/MersenneTwister.java b/src/main/java/org/apache/commons/rng/internal/source32/MersenneTwister.java
index 05d11a4..37bc821 100644
--- a/src/main/java/org/apache/commons/rng/internal/source32/MersenneTwister.java
+++ b/src/main/java/org/apache/commons/rng/internal/source32/MersenneTwister.java
@@ -145,10 +145,10 @@ public class MersenneTwister extends IntProvider {
int j = 0;
for (int k = Math.max(N, seed.length); k != 0; k--) {
- final long l0 = (mt[i] & LOWER_MASK_LONG) | ((mt[i] < 0) ? UPPER_MASK_LONG : 0);
- final long l1 = (mt[i-1] & LOWER_MASK_LONG) | ((mt[i-1] < 0) ? UPPER_MASK_LONG : 0);
- final long l = (l0 ^ ((l1 ^ (l1 >> 30)) * 1664525l)) + seed[j] + j; // non linear
- mt[i] = (int) (l & INT_MASK_LONG);
+ final long l0 = (mt[i] & LOWER_MASK_LONG) | ((mt[i] < 0) ? UPPER_MASK_LONG : 0);
+ final long l1 = (mt[i - 1] & LOWER_MASK_LONG) | ((mt[i - 1] < 0) ? UPPER_MASK_LONG : 0);
+ final long l = (l0 ^ ((l1 ^ (l1 >> 30)) * 1664525l)) + seed[j] + j; // non linear
+ mt[i] = (int) (l & INT_MASK_LONG);
i++; j++;
if (i >= N) {
mt[0] = mt[N - 1];
@@ -160,10 +160,10 @@ public class MersenneTwister extends IntProvider {
}
for (int k = N - 1; k != 0; k--) {
- final long l0 = (mt[i] & LOWER_MASK_LONG) | ((mt[i] < 0) ? UPPER_MASK_LONG : 0);
- final long l1 = (mt[i-1] & LOWER_MASK_LONG) | ((mt[i-1] < 0) ? UPPER_MASK_LONG : 0);
+ final long l0 = (mt[i] & LOWER_MASK_LONG) | ((mt[i] < 0) ? UPPER_MASK_LONG : 0);
+ final long l1 = (mt[i - 1] & LOWER_MASK_LONG) | ((mt[i - 1] < 0) ? UPPER_MASK_LONG : 0);
final long l = (l0 ^ ((l1 ^ (l1 >> 30)) * 1566083941l)) - i; // non linear
- mt[i] = (int) (l & INT_MASK_LONG);
+ mt[i] = (int) (l & INT_MASK_LONG);
i++;
if (i >= N) {
mt[0] = mt[N - 1];
@@ -181,10 +181,10 @@ public class MersenneTwister extends IntProvider {
*/
private void initState(int seed) {
long longMT = seed & INT_MASK_LONG;
- mt[0]= (int) longMT;
+ mt[0] = (int) longMT;
for (mti = 1; mti < N; ++mti) {
longMT = (1812433253L * (longMT ^ (longMT >> 30)) + mti) & INT_MASK_LONG;
- mt[mti]= (int) longMT;
+ mt[mti] = (int) longMT;
}
}
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/dbf0756a/src/main/java/org/apache/commons/rng/internal/util/IntArray2LongArray.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/rng/internal/util/IntArray2LongArray.java b/src/main/java/org/apache/commons/rng/internal/util/IntArray2LongArray.java
index 0c48f5a..27557d1 100644
--- a/src/main/java/org/apache/commons/rng/internal/util/IntArray2LongArray.java
+++ b/src/main/java/org/apache/commons/rng/internal/util/IntArray2LongArray.java
@@ -30,7 +30,7 @@ public class IntArray2LongArray implements SeedConverter<int[], long[]> {
for (int i = 0; i < outSize; i++) {
final int lo = seed[i];
final int hi = outSize + i < seed.length ? seed[outSize + i] : 0;
- out[i] = NumberFactory.makeLong(hi, lo) ;
+ out[i] = NumberFactory.makeLong(hi, lo);
}
return out;