<commit_before>/**
 * Created by <NAME> on 20/03/15.
 * https://ipsec.pl/
 */

"use strict";

function go() {
    // framebuster
    if (self == top) {
        console.log('main view enabled');
        document.documentElement.style.display = 'block';
    } else {
        console.warn('frames detected');
        top.location = self.location;
    }

    window['sjcl']['random']['startCollectors']();
    window['nr'] = new NistRandom;

    document.getElementById('plot-button').addEventListener('click', runPlots);

}

function runPlots() {
    histogram('sjcl-hist', 'sjcl', 'sjcl-hist-n');
    histogram('math-hist', 'math', 'math-hist-n');
    plot('sjcl-plot', 'sjcl', 'sjcl-plot-n');
    plot('math-plot', 'math', 'math-plot-n');
}

/**
 * Plot a histogram of PRNG output.
 */
function histogram(where, how, n) {
    var e = document.getElementById(where);
    var c = e.getContext('2d');
    var cw = e.width - 1;
    var ch = e.height - 1; // no need for full height

    // histogram bucket width is 10, represented by a single pixel
    var bucket_width = 10;
    // PRNG is sampled cw*ch times
    var num_points = cw * ch;

    // initialize buckets
    var buckets = Array(cw);
    for (var i = 0; i < cw; i++) {
        buckets[i] = 0; // by default it's undefined

    }

    var output;
    // toss the numbers into buckets
    for (i = 0; i < num_points; i++) {
<commit_msg>update buttong content when drawing<commit_after>/**
 * Created by <NAME> on 20/03/15.
 * https://ipsec.pl/
 */

"use strict";

function go() {
    // framebuster
    if (self == top) {
        console.log('main view enabled');
        document.documentElement.style.display = 'block';
    } else {
        console.warn('frames detected');
        top.location = self.location;
    }

    window['sjcl']['random']['startCollectors']();
    window['nr'] = new NistRandom;

    document.getElementById('plot-button').addEventListener('click', runPlots);

}

function runPlots() {
    var e = document.createElement('span');
    e.setAttribute("class", "glyphicon glyphicon-refresh spinning");
    e.setAttribute('aria-hidden', 'true');
    document.getElementById('plot-button').textContent = "";
    document.getElementById('plot-button').appendChild(e);

    histogram('sjcl-hist', 'sjcl', 'sjcl-hist-n');
    histogram('math-hist', 'math', 'math-hist-n');
    plot('sjcl-plot', 'sjcl', 'sjcl-plot-n');
    plot('math-plot', 'math', 'math-plot-n');

    document.getElementById('plot-button').textContent = "Run!";
}

/**
 * Plot a histogram of PRNG output.
 */
function histogram(where, how, n) {
    var e = document.getElementById(where);
    var c = e.getContext('2d');
    var cw = e.width - 1;
    var ch = e.height - 1; // no need for full height

    // histogram bucket width is 10, represented by a single pixel
    var bucket_width = 10;
    // PRNG is sampled cw*ch times
    var num_points = cw * ch;

    // initialize buckets
    var buckets = Array(cw);
    for (var i = 0; i < cw; i++) {
        buckets[i] = 0; // by default it's undefined

    }

    var output;
    // toss the numbers into buckets
    for (i = 0; i < num_points; i++) {

{'fraction_non_alphanumeric': 0.16756585211044114, 'fraction_numerical': 0.010155506188511583, 'mean_word_length': 2.7884615384615383, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '687709', 'n_tokens_mistral': 1076, 'n_tokens_neox': 1023, 'n_words': 271}