test_class.declarator: drng
test_class.modifier: private
test_class.original_string: private DrngImpl drng;
test_class.type: DrngImpl
test_class.var_name: drng
test_class.file: core/src/test/java/dk/alexandra/fresco/framework/util/TestDrngImpl.java
test_class.identifier: TestDrngImpl
test_case.body: @Test
    public void testNextBit() {
      int iterations = 1000;
  
      int trueCount = 0;
      int falseCount = 0;
      for (int i = 0; i < iterations; i++) {
        boolean currentRand = drng.nextBit();
        if (currentRand) {
          trueCount++;
        } else {
          falseCount++;
        }
      }
      // Sanity check the randomness, by verifying that there are both true and false values returned
      assertTrue(trueCount > iterations / 10);
      assertTrue(falseCount > iterations / 10);
    }
test_case.class_method_signature: TestDrngImpl.testNextBit()
test_case.full_signature: @Test public void testNextBit()
test_case.identifier: testNextBit
test_case.invocations: nextBit assertTrue assertTrue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testNextBit()
focal_class.declarator: RANDOMBUFFER_SIZE = 16
focal_class.modifier: private static final
focal_class.original_string: private static final int RANDOMBUFFER_SIZE = 16;
focal_class.type: int
focal_class.var_name: RANDOMBUFFER_SIZE
focal_class.declarator: drbg
focal_class.modifier: private
focal_class.original_string: private Drbg drbg;
focal_class.type: Drbg
focal_class.var_name: drbg
focal_class.declarator: randomBytes = new byte[RANDOMBUFFER_SIZE]
focal_class.modifier: private
focal_class.original_string: private byte[] randomBytes = new byte[RANDOMBUFFER_SIZE];
focal_class.type: byte[]
focal_class.var_name: randomBytes
focal_class.declarator: bitsLeft = 0
focal_class.modifier: private
focal_class.original_string: private int bitsLeft = 0;
focal_class.type: int
focal_class.var_name: bitsLeft
focal_class.file: core/src/main/java/dk/alexandra/fresco/framework/util/DrngImpl.java
focal_class.identifier: DrngImpl
focal_class.interfaces: implements Drng
focal_class.class_method_signature: DrngImpl.DrngImpl(Drbg drbg)
focal_class.full_signature: public  DrngImpl(Drbg drbg)
focal_class.identifier: DrngImpl
focal_class.modifiers: public
focal_class.parameters: (Drbg drbg)
focal_class.signature:  DrngImpl(Drbg drbg)
focal_class.class_method_signature: DrngImpl.nextInt(int limit)
focal_class.full_signature: @Override public int nextInt(int limit)
focal_class.identifier: nextInt
focal_class.modifiers: @Override public
focal_class.parameters: (int limit)
focal_class.return: int
focal_class.signature: int nextInt(int limit)
focal_class.class_method_signature: DrngImpl.nextLong(long limit)
focal_class.full_signature: @Override public long nextLong(long limit)
focal_class.identifier: nextLong
focal_class.modifiers: @Override public
focal_class.parameters: (long limit)
focal_class.return: long
focal_class.signature: long nextLong(long limit)
focal_class.class_method_signature: DrngImpl.nextBigInteger(BigInteger limit)
focal_class.full_signature: @Override public BigInteger nextBigInteger(BigInteger limit)
focal_class.identifier: nextBigInteger
focal_class.modifiers: @Override public
focal_class.parameters: (BigInteger limit)
focal_class.return: BigInteger
focal_class.signature: BigInteger nextBigInteger(BigInteger limit)
focal_class.class_method_signature: DrngImpl.nextBit()
focal_class.full_signature: @Override public boolean nextBit()
focal_class.identifier: nextBit
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean nextBit()
focal_class.class_method_signature: DrngImpl.getBytes(int bitSize)
focal_class.full_signature: private byte[] getBytes(int bitSize)
focal_class.identifier: getBytes
focal_class.modifiers: private
focal_class.parameters: (int bitSize)
focal_class.return: byte[]
focal_class.signature: byte[] getBytes(int bitSize)
focal_method.body: @Override
    public boolean nextBit() {
      if (bitsLeft == 0) {
        drbg.nextBytes(randomBytes);
        bitsLeft = RANDOMBUFFER_SIZE * Byte.SIZE;
      }
      int index = RANDOMBUFFER_SIZE * Byte.SIZE - bitsLeft;
      byte currentByte = randomBytes[index / (Byte.SIZE)];
      byte currentBit = (byte) (currentByte >> (index % (Byte.SIZE)));
      bitsLeft--;
      return currentBit == 0x00 ? false : true;
    }
focal_method.class_method_signature: DrngImpl.nextBit()
focal_method.full_signature: @Override public boolean nextBit()
focal_method.identifier: nextBit
focal_method.invocations: nextBytes
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: boolean
focal_method.signature: boolean nextBit()