code: public byte[] generateSeed(int length) throws SeedException
      {
          byte[] seedData = new byte[length];
          try
          {
              cacheLock.lock();
              int count = 0;
              while (count < length)
              {
                  if (cacheOffset < cache.length)
                  {
                      int numberOfBytes = Math.min(length - count, cache.length - cacheOffset);
                      System.arraycopy(cache, cacheOffset, seedData, count, numberOfBytes);
                      count += numberOfBytes;
                      cacheOffset += numberOfBytes;
                  }
                  else
                  {
                      refreshCache(length - count);
                  }
              }
          }
          catch (IOException ex)
          {
              throw new SeedException("Failed downloading bytes from " + BASE_URL, ex);
          }
          catch (SecurityException ex)
          {
              // Might be thrown if resource access is restricted (such as in an applet sandbox).
              throw new SeedException("SecurityManager prevented access to " + BASE_URL, ex);
          }
          finally
          {
              cacheLock.unlock();
          }
          return seedData;
      }
docs: {@inheritDoc}