### Question:
KeanuRandom { public DoubleTensor nextGamma(long[] shape, DoubleTensor theta, DoubleTensor k) { return Gamma.withParameters(theta, k).sample(shape, this); } 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 canSampleGammaScalar() { assertEquals(0, random.nextGamma(new long[0], DoubleTensor.scalar(2), DoubleTensor.scalar(2)).getRank()); assertEquals(1, random.nextGamma(new long[]{1}, DoubleTensor.scalar(2), DoubleTensor.scalar(2)).getRank()); assertEquals(2, random.nextGamma(new long[]{1, 1}, DoubleTensor.scalar(2), DoubleTensor.scalar(2)).getRank()); assertEquals(2, random.nextGamma(new long[]{2, 3}, DoubleTensor.scalar(2), DoubleTensor.scalar(2)).getRank()); }