mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
use .fill to initialise Arrays
This commit is contained in:
parent
d41d56e670
commit
5b03a84be8
3 changed files with 3 additions and 14 deletions
|
@ -88,17 +88,12 @@ const Entropy = {
|
|||
runFreqDistrib: function (input, args) {
|
||||
if (!input.length) return "No data";
|
||||
|
||||
let distrib = new Array(256),
|
||||
let distrib = new Array(256).fill(0),
|
||||
percentages = new Array(256),
|
||||
len = input.length,
|
||||
showZeroes = args[0],
|
||||
i;
|
||||
|
||||
// Initialise distrib to 0
|
||||
for (i = 0; i < 256; i++) {
|
||||
distrib[i] = 0;
|
||||
}
|
||||
|
||||
// Count bytes
|
||||
for (i = 0; i < len; i++) {
|
||||
distrib[input[i]]++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue