Add entropy to the pools.
@param data The entropic value.  Should be a 32-bit integer, array of 32-bit integers, or string
@param {Number} estimatedEntropy The estimated entropy of data, in bits
@param {String} source The source of the entropy, eg "mouse"
332877
function (data, estimatedEntropy, source) {
    source = source || "user";

    var id,
      i, tmp,
      t = (new Date()).valueOf(),
      robin = this._robins[source],
      oldReady = this.isReady(), err = 0, objName;

    id = this._collectorIds[source];
    if (id === undefined) { id = this._collectorIds[source] = this._collectorIdNext ++; }

    if (robin === undefined) { robin = this._robins[source] = 0; }
    this._robins[source] = ( this._robins[source] + 1 ) % this._pools.length;

    switch(typeof(data)) {

    case "number":
      if (estimatedEntropy === undefined) {
        estimatedEntropy = 1;
      }
      this._pools[robin].update([id,this._eventId++,1,estimatedEntropy,t,1,data|0]);
      break;

    case "object":
      objName = Object.prototype.toString.call(data);
      if (objName === "[object Uint32Array]") {
        tmp = [];
        for (i = 0; i < data.length; i++) {
          tmp.push(data[i]);
        }
        data = tmp;
      } else {
        if (objName !== "[object Array]") {
          err = 1;
        }
        for (i=0; i<data.length && !err; i++) {
          if (typeof(data[i]) !== "number") {
            err = 1;
          }
        }
      }
      if (!err) {
        if (estimatedEntropy === undefined) {
          /* horrible entropy estimator */
          estimatedEntropy = 0;
          for (i=0; i<data.length; i++) {
            tmp= data[i];
            while (tmp>0) {
              estimatedEntropy++;
              tmp = tmp >>> 1;
            }
          }
        }
        this._pools[robin].update([id,this._eventId++,2,estimatedEntropy,t,data.length].concat(data));
      }
      break;

    case "string":
      if (estimatedEntropy === undefined) {
       /* English text has just over 1 bit per character of entropy.
        * But this might be HTML or something, and have far less
        * entropy than English...  Oh well, let's just say one bit.
        */
       estimatedEntropy = data.length;
      }
      this._pools[robin].update([id,this._eventId++,3,estimatedEntropy,t,data.length]);
      this._pools[robin].update(data);
      break;

    default:
      err=1;
    }
    if (err) {
      throw new sjcl.exception.bug("random: addEntropy only supports number, array of numbers or string");
    }

    /* record the new strength */
    this._poolEntropy[robin] += estimatedEntropy;
    this._poolStrength += estimatedEntropy;

    /* fire off events */
    if (oldReady === this._NOT_READY) {
      if (this.isReady() !== this._NOT_READY) {
        this._fireEvent("seeded", Math.max(this._strength, this._poolStrength));
      }
      this._fireEvent("progress", this.getProgress());
    }
  }
202721
public void addParameter(String name, String sub, Object data) {
        pack(name);
        pack(sub);
        pack(BrokerUtil.toString(data));
    }
71264
def entropy_H(self, data):
        """"""
        
        if len(data) == 0:
            return 0.0
        
        occurences = array.array('L', [0]*256)
        
        for x in data:
            occurences[ord(x)] += 1
        
        entropy = 0
        for x in occurences:
            if x:
                p_x = float(x) / len(data)
                entropy -= p_x*math.log(p_x, 2)
        
        return entropy
749021
function(into, data) {
                            var existingDataLen = into.length == 0 ? 0 : into[0].length - 1;
                            var i = 0;
                            var j = 0;
                            for (; i<into.length && j<data.length; ) {
                                if (into[i][0] == data[j][0]) {
                                    into[i].push(data[j][1]);
                                    i++;
                                    j++;
                                }
                                else if (into[i][0] < data[j][0]) {
                                    into[i].push(null);
                                    i++;
                                }
                                else {
                                    var arr = [data[j][0]];
                                    for (var k=1; k<into[i].length; k++) {
                                        arr.push(null);
                                    }
                                    arr.push(data[j][1]);
                                    into.splice(i,0,arr);
                                    i++;
                                    j++;
                                }
                            }
                            while (j<data.length) {
                                var arr = [data[j][0]];
                                for (var k=0; k<existingDataLen; k++) {
                                    arr.push(null);
                                }
                                arr.push(data[j][1]);
                                into.push(arr);
                                j++;
                            }
                        }
393855
function extendData({
  data,
  lengthAngle: totalAngle,
  totalValue,
  paddingAngle,
}) {
  const total = totalValue || sumValues(data);
  const normalizedTotalAngle = valueBetween(totalAngle, -360, 360);
  const numberOfPaddings =
    Math.abs(normalizedTotalAngle) === 360 ? data.length : data.length - 1;
  const degreesTakenByPadding =
    Math.abs(paddingAngle) * numberOfPaddings * Math.sign(normalizedTotalAngle);
  const singlePaddingDegrees = degreesTakenByPadding / numberOfPaddings;
  const degreesTakenByPaths = normalizedTotalAngle - degreesTakenByPadding;
  let lastSegmentEnd = 0;

  return data.map(dataEntry => {
    const valueInPercentage = (dataEntry.value / total) * 100;
    const degrees = extractPercentage(degreesTakenByPaths, valueInPercentage);
    const startOffset = lastSegmentEnd;
    lastSegmentEnd = lastSegmentEnd + degrees + singlePaddingDegrees;

    return {
      percentage: valueInPercentage,
      degrees,
      startOffset,
      ...dataEntry,
    };
  });
}
1314124
def energy_entropy(data, fs, numOfShortBlocks=10):
    """"""
    data = np.mean(data, axis=1)

    Eol = np.sum(data ** 2)    # total data energy
    L = len(data)
    subWinLength = int(np.floor(L / numOfShortBlocks))
    if L != subWinLength * numOfShortBlocks:
        data = data[0:subWinLength * numOfShortBlocks]

    # subWindows is of size [numOfShortBlocks x L]
    subWindows = data.reshape(subWinLength, numOfShortBlocks, order='F').copy()

    # Compute normalized sub-data energies:
    s = np.sum(subWindows ** 2, axis=0) / (Eol + EPSILON)

    # Compute entropy of the normalized sub-data energies:
    Entropy = -np.sum(s * np.log2(s + EPSILON))
    return Entropy
831293
function(data) {
      if (!data) {
        data = this.getContent();
      }
      return this.encoder.encryptAes(JSON.stringify(data), this.getSecret());
    }
1150163
function (data) {
            // Convert string to WordArray, else assume WordArray already
            if (typeof data == 'string') {
                data = Utf8.parse(data);
            }

            // Append
            this._data.concat(data);
            this._nDataBytes += data.sigBytes;
        }
735649
public void addData(final Data DATA) {
        sum += DATA.getValue();
        window.add(DATA);
        if (window.size() > numberPeriod) {
            sum -= window.remove().getValue();
        }
    }
530730
function setRandomData(data){

    // Include each key with a small chance
    var randomKeys = Object.keys(data[0]).filter(function(d){
          return Math.random() < 0.5;
        }),

        // Make a copy of the objects with only the
        // random keys included.
        dataWithRandomKeys = data.map(function (d) {
          var e = {};
          randomKeys.forEach(function (key) {
            e[key] = d[key];
          });
          return e;
        }),

        // Include each element with a small chance
        randomSample = dataWithRandomKeys.filter(function(d){
          return Math.random() < 0.1;
        });

    // Update the table with the random data.
    table.set({
      data: randomSample,
      columns: randomKeys.map(function (key) {
        return {
          title: capitalize(key),
          property: key
        };
      })
    });
  }
154576
private void init(byte[] data, int offset, int len) throws IOException {
        if ((offset+2 > data.length) || (offset+len > data.length)) {
            throw new IOException("Encoding bytes too short");
        }
        // check for indefinite length encoding
        if (DerIndefLenConverter.isIndefinite(data[offset+1])) {
            byte[] inData = new byte[len];
            System.arraycopy(data, offset, inData, 0, len);

            DerIndefLenConverter derIn = new DerIndefLenConverter();
            buffer = new DerInputBuffer(derIn.convert(inData));
        } else
            buffer = new DerInputBuffer(data, offset, len);
        buffer.mark(Integer.MAX_VALUE);
    }
44944
def shannon_entropy(data, iterator):
    
    if not data:
        return 0
    entropy = 0
    for x in iterator:
        p_x = float(data.count(x))/len(data)
        if p_x > 0:
            entropy += - p_x*math.log(p_x, 2)
    return entropy
1006910
function _seed() {
    // create a plugin-based message digest
    var md = ctx.plugin.md.create();

    // digest pool 0's entropy and restart it
    md.update(ctx.pools[0].digest().getBytes());
    ctx.pools[0].start();

    // digest the entropy of other pools whose index k meet the
    // condition '2^k mod n == 0' where n is the number of reseeds
    var k = 1;
    for(var i = 1; i < 32; ++i) {
      // prevent signed numbers from being used
      k = (k === 31) ? 0x80000000 : (k << 2);
      if(k % ctx.reseeds === 0) {
        md.update(ctx.pools[i].digest().getBytes());
        ctx.pools[i].start();
      }
    }

    // get digest for key bytes and iterate again for seed bytes
    var keyBytes = md.digest().getBytes();
    md.start();
    md.update(keyBytes);
    var seedBytes = md.digest().getBytes();

    // update
    ctx.key = ctx.plugin.formatKey(keyBytes);
    ctx.seed = ctx.plugin.formatSeed(seedBytes);
    ctx.reseeds = (ctx.reseeds === 0xffffffff) ? 0 : ctx.reseeds + 1;
    ctx.generated = 0;
  }
866615
public void appendData(byte[] data) throws IOException, SymmetricKeyException {
        if (data == null)
            return;
        appendData(data, 0, data.length);
    }
787363
def _set_data(self, data, offset=None, copy=False):
        
        
        # Copy if needed, check/normalize shape
        data = np.array(data, copy=copy)
        data = self._normalize_shape(data)
        
        # Maybe resize to purge DATA commands?
        if offset is None:
            self._resize(data.shape)
        elif all([i == 0 for i in offset]) and data.shape == self._shape:
            self._resize(data.shape)
        
        # Convert offset to something usable
        offset = offset or tuple([0 for i in range(self._ndim)])
        assert len(offset) == self._ndim
        
        # Check if data fits
        for i in range(len(data.shape)-1):
            if offset[i] + data.shape[i] > self._shape[i]:
                raise ValueError("Data is too large")
        
        # Send GLIR command
        self._glir.command('DATA', self._id, offset, data)
1327010
def Update(self, data):
        
        heads, tails = data
        self.alpha += heads
        self.beta += tails
697008
public void append(byte[] data, int start, int len) {
        if (len <= 0) {
            return;
        }
        byte[] newData = new byte[len];
        System.arraycopy(data, 0, newData, 0, len);
        append(newData);
    }