private void max100PercentOfOriginalPower(
     PtuFlexRequestDto ptuFlexRequestDto, PtuFlexOfferDto ptuFlexOfferDto) {
   BigDecimal percentage = BigDecimal.valueOf(Math.abs(new Random().nextDouble() % 1));
   // Offer up to 0% of the requested power and max 100%
   ptuFlexOfferDto.setPower(
       percentage
           .multiply(new BigDecimal(ptuFlexRequestDto.getPower()), MathContext.DECIMAL64)
           .toBigInteger());
   ptuFlexOfferDto.setPrice(
       BigDecimal.valueOf(0.4)
           .multiply(new BigDecimal(ptuFlexOfferDto.getPower()), MathContext.DECIMAL64));
 }
 private void populateFlexOfferDto(
     FlexOfferDto flexOfferDto, FlexRequestDto flexRequestDto, boolean populatePtus) {
   flexOfferDto.setPeriod(flexRequestDto.getPeriod());
   flexOfferDto.setConnectionGroupEntityAddress(flexRequestDto.getConnectionGroupEntityAddress());
   flexOfferDto.setParticipantDomain(flexRequestDto.getParticipantDomain());
   if (populatePtus) {
     flexRequestDto
         .getPtus()
         .stream()
         .forEach(
             ptuFlexRequestDto -> {
               PtuFlexOfferDto ptuFlexOfferDto = new PtuFlexOfferDto();
               ptuFlexOfferDto.setPtuIndex(ptuFlexRequestDto.getPtuIndex());
               if (ptuFlexRequestDto.getDisposition() == DispositionTypeDto.AVAILABLE) {
                 ptuFlexOfferDto.setPrice(BigDecimal.ZERO);
                 ptuFlexOfferDto.setPower(BigInteger.ZERO);
               } else {
                 max100PercentOfOriginalPower(ptuFlexRequestDto, ptuFlexOfferDto);
               }
               flexOfferDto.getPtus().add(ptuFlexOfferDto);
             });
   }
 }