### Question:
KeanuRandom { public DoubleTensor nextDouble(long[] shape) { final int length = getLengthAsInt(shape); if (length > 1) { return DoubleTensor.create(nextDoubleBuffer(length), shape); } else { return DoubleTensor.create(nextDouble(), shape); } } KeanuRandom();  KeanuRandom(long seed); static KeanuRandom getDefaultRandom(); static void setDefaultRandomSeed(long seed); DoubleTensor nextDouble(long[] shape); double nextDouble(); double nextDouble(double min, double max); double nextDoubleNonZero(); DoubleTensor nextGaussian(long[] shape); DoubleTensor nextGaussian(long[] shape, DoubleTensor mu, DoubleTensor sigma); DoubleTensor nextGamma(long[] shape, DoubleTensor theta, DoubleTensor k); DoubleTensor nextLaplace(long[] shape, DoubleTensor mu, DoubleTensor beta); double nextGaussian(); double nextGaussian(double mu, double sigma); boolean nextBoolean(); IntegerTensor nextInt(long[] shape); IntegerTensor nextPoisson(long[] shape, DoubleTensor mu); int nextInt(int maxExclusive); int nextInt();  }### Answer:
@Test public void canSampleUniformScalar() { assertEquals(0, random.nextDouble(new long[0]).getRank()); assertEquals(1, random.nextDouble(new long[]{1}).getRank()); assertEquals(2, random.nextDouble(new long[]{1, 1}).getRank()); assertEquals(2, random.nextDouble(new long[]{2, 3}).getRank()); }
@Test public void randomNumberGenerationIsPlatformIndependent() { KeanuRandom keanuRandom = new KeanuRandom(1); assertEquals(keanuRandom.nextDouble(), new MersenneTwister(1L).nextDouble()); assertEquals(keanuRandom.nextDouble(), 0.41782887182714457, 1e-16); }