code: public static double[] ttbd(double target, double[] lower, double[] upper, RandomGenerator randomGenerator) {
          // Check dimension match:
          if (lower.length != upper.length) {
              throw new IllegalArgumentException("Lower and upper bounds must be of same length.");
          }
  
          // Get indices and shuffle:
          final int[] indices = DMatrixUtils.shuffleIndices(lower.length, randomGenerator);
  
          // Call auxiliary function:
          final double[] ttbdValues = DMatrixUtils._ttbdInner(
                  target,
                  DMatrixUtils.applyIndices(lower, indices),
                  DMatrixUtils.applyIndices(upper, indices),
                  randomGenerator);
  
          // Reapply original indices and return:
          return DMatrixUtils.applyIndices(ttbdValues, DMatrixUtils.getOrder(indices));
      }
docs: Returns a target-total bounded distribution sample.
  
  <p>
  
  Note that this method is not the actual workhorse. This very method first
  shuffles indices, calls the workhorse, and readjust as per original indices.
  
  @param target The target total value.
  @param lower Lower limits.
  @param upper Upper limits.
  @param randomGenerator The random generator.
  @return A vector of target-total bounded sample.