code: public SplitSecretOutput split(final BigInteger secret,
                                     final Random random)
      {
          if (secret == null)
          {
              throw new SecretShareException("Secret cannot be null");
          }
          if (secret.signum() <= 0)
          {
              throw new SecretShareException("Secret cannot be negative");
          }
          if (publicInfo.getPrimeModulus() != null)
          {
              checkThatModulusIsAppropriate(publicInfo.getPrimeModulus(),
                                            secret);
  
          }
  
          BigInteger[] coeffs = new BigInteger[publicInfo.getK()];
  
          // create the equation by setting the coefficients:
          // [a] randomize the coefficients:
          randomizeCoeffs(coeffs, random, publicInfo.getPrimeModulus(), secret);
          // [b] set the constant coefficient to the secret:
          coeffs[0] = secret;
  
          final PolyEquationImpl equation = new PolyEquationImpl(coeffs);
  
          SplitSecretOutput ret = new SplitSecretOutput(this.publicInfo,
                                                        equation);
  
          for (int x = 1, n = publicInfo.getNforSplit() + 1; x < n; x++)
          {
              final BigInteger fofx = equation.calculateFofX(BigInteger.valueOf(x));
              BigInteger data = fofx;
              if (publicInfo.primeModulus != null)
              {
                  data = data.mod(publicInfo.primeModulus);
              }
              final ShareInfo share = new ShareInfo(x, data, this.publicInfo);
              if (publicInfo.primeModulus != null)
              {
                  if (data.compareTo(publicInfo.getPrimeModulus()) > 0)
                  {
                      throw new RuntimeException("" + data + "\n" + publicInfo.getPrimeModulus() + "\n");
                  }
              }
              ret.sharesInfo.add(share);
          }
  
          return ret;
      }
docs: Split the secret into pieces, where the caller controls the random instance.
  
  @param secret to split
  @param random to use for random number generation
  @return split secret output instance