/** * Constructs a new batch of correlated OTs with errors. * * @param size Amount of OTs to construct */ public List<StrictBitVector> extend(int size) { if (size < 1) { throw new IllegalArgumentException("The amount of OTs must be a positive integer"); } if (size % Byte.SIZE != 0) { throw new IllegalArgumentException( "The amount of OTs must be a positive integer divisible by 8"); } int bytesNeeded = size / Byte.SIZE; final List<StrictBitVector> tlist = prgs.parallelStream() .limit(resources.getComputationalSecurityParameter()) .map(drbg -> { byte[] bytes = new byte[bytesNeeded]; drbg.nextBytes(bytes); return bytes; }) .map(StrictBitVector::new) .collect(Collectors.toList()); final List<StrictBitVector> ulist = receiveList(resources.getComputationalSecurityParameter()); IntStream.range(0, resources.getComputationalSecurityParameter()).parallel() .filter(i -> otChoices.getBit(i, false)) .forEach(i -> tlist.get(i).xor(ulist.get(i))); return Transpose.transpose(tlist); }