use of org.scijava.util.MersenneTwisterFast in project imagej-ops by imagej.
the class AbstractOpTest method generateUnsigned128BitArrayTestImg.
public ArrayImg<Unsigned128BitType, LongArray> generateUnsigned128BitArrayTestImg(final boolean fill, final long... dims) {
ArrayImg<Unsigned128BitType, LongArray> bits = ArrayImgs.unsigned128Bits(dims);
if (fill) {
MersenneTwisterFast betterRNG = new MersenneTwisterFast(0xf1eece);
for (Unsigned128BitType b : bits) {
BigInteger big = BigInteger.valueOf(betterRNG.nextLong());
b.set(big);
}
}
return bits;
}
use of org.scijava.util.MersenneTwisterFast in project imagej-ops by imagej.
the class AbstractOpTest method generateUnboundedIntegerTypeListTestImg.
public ListImg<UnboundedIntegerType> generateUnboundedIntegerTypeListTestImg(final boolean fill, final long... dims) {
final ListImg<UnboundedIntegerType> l = new ListImgFactory<UnboundedIntegerType>().create(dims, new UnboundedIntegerType());
final BigInteger[] array = new BigInteger[(int) Intervals.numElements(dims)];
RandomAccess<UnboundedIntegerType> ra = l.randomAccess();
if (fill) {
MersenneTwisterFast betterRNG = new MersenneTwisterFast(0xf1eece);
for (int i = 0; i < Intervals.numElements(dims); i++) {
BigInteger val = BigInteger.valueOf(betterRNG.nextLong());
ra.get().set(val);
ra.fwd(0);
}
}
return l;
}
Aggregations