<commit_before>/*
 * Generator.js
 * Written by <NAME> 11/19/16
 *
 * Functional interface for generating random things
 * TODO: add username generation
 */

"use strict";

exports.generate = function() {
	var identifier = "";
    var allowedChars = "abcdefghijklmnopqrstuvwxyz0123456789";
    
    for(var i=0; i < 32; i++)
        identifier += allowedChars.charAt(Math.floor(Math.random() * allowedChars.length));

    return identifier;
};

exports.generateUsername = function() {
    const adj = ['Abominable', 'Astonishing', 'Acrimonious', 'Fantastic', 'Wonderful', 'Adventurous', 'Bitter', 'Frustrated',
        'Criminal', 'Functional', 'Beautiful', 'Crushing', 'Satisfied', 'Monstrous', 'Curious', 'Terse', 'Interested',
        'ProcedurallyGenerated', 'Anonymous', 'Functional', 'Appreciative', 'Horrified', 'Lustrous', 'Viscous', 'Thermodynamic',
        'Presidential', 'Opaque', 'StructurallySound', 'Unstable', ''];
    const noun = ['Antelope', 'Anteater', 'ArtSci', 'Computer', 'Virus', 'Program', 'Circuit', 'Gear', 'Chemical',
        'Molecule', 'Element', 'FREC', 'Plant', 'Particle', 'Cell', 'Mystery', 'Math', 'Problem', 'Proof', 'Theory', 'Method',
        'Diode', 'Geode', 'Pickax', 'Pixel', 'Rock', 'Mineral', 'Force', 'Metal', 'Ceramic', 'Crystal', 'FreeBodyDiagram',
        'Transistor', 'Function'];

    return adj[Math.floor(Math.random() * adj.length)] + noun[Math.floor(Math.random() * noun.length)];
};<commit_msg>Extending functionality of Generator<commit_after>/*
 * Generator.js
 * Written by <NAME> 11/19/16
 *
 * Functional interface for generating random things
 */

"use strict";

/** Generates a system unique 32 char string
 *
 * @returns {*} A 32 char alphanumberic string (a UUID)
 */
exports.generate = function() {
    return generateUUID0(32);
};

/** Generates a random 6 char string
 *
 * @returns {*} A 6 char alphanumberic string
 */
exports.generateShort = function() {
    return generateUUID0(6);
};

/** Generates a random 2 char string
 *
 * @returns {*} A 2 char alphanumberic string
 */
exports.generateXShort = function() {
    return generateUUID0(2);
};

/** For when the built-ins just don't do the trick... Use them first, there's no sense hardcoding numbers throughout code
 *
 * @param length the desired length of the alphanumberic string
 * @returns {string} the string of length @length
 */
exports.generateIdentifierOfLength = function(length) {
    return generateUUID0(length);
};

exports.generateUsername = function() {
    const adj = ['Abominable', 'Astonishing', 'Acrimonious', 'Fantastic', 'Wonderful', 'Adventurous', 'Bitter', 'Frustrated',
        'Criminal', 'Stirling', 'Beautiful', 'Crushing', 'Satisfied', 'Monstrous', 'Curious', 'Terse', 'Interested',
        'ProcedurallyGenerated', 'Anonymous', 'Functional', 'Appreciative', 'Horrified', 'Lustrous', 'Viscous', 'Thermodynamic',
        'Presidential', 'Opaque', 'StructurallySound', 'Unstable', 'Free', 'Floundering', 'Helpful', 'Unusual', 'Bubbly',
        'Programmatic', 'Auxiliary', 'Enraged', 'Robotic', 'Mechatronic', 'Chemical', 'Mechanical', 'Civil', 'Electrical',
        'Explosive', 'Enigmatic', 'Misanthropic', 'Human', 'Robotic', 'Environmental', 'Thoughtful', 'Eager', 'Neat',
        'Destructive'];
    const noun = ['Antelope', 'Anteater', 'ArtSci', 'Computer', 'Virus', 'Program', 'Circuit', 'Gear', 'Chemical',
        'Molecule', 'Element', 'Plant', 'Particle', 'Cell', 'Mystery', 'Math', 'Problem', 'Proof', 'Theory', 'Method',
        'Diode', 'Geode', 'Pickax', 'Pixel', 'Rock', 'Mineral', 'Force', 'Metal', 'Ceramic', 'Crystal', 'FreeBodyDiagram',
        'Transistor', 'Function', 'Puppy', 'Kitten', 'Dragonfly', 'Equations', 'Snippet', 'Atom', 'Molecule', 'Solution',
        'Structure', 'Cross-Beam', 'Truss', 'Dynamite', 'Proof', 'Theory', 'Theorem', 'Equation', 'Enigma', 'Robot',
        'Trajectory', 'Map', 'Mystery', 'Problem', 'FREChawk', 'Fusion'];

    return adj[Math.floor(Math.random() * adj.length)] + noun[Math.floor(Math.random() * noun.length)];
};

/**
 * Generic alphanumberic string generator. Note that the longer the identifier is the more likely it is to be unique.
 *
 * @param length length of the identifier to create
 * @returns {string} the random identifier
 */
function generateUUID0(length) {
    var identifier = "";
    const allowedChars = "abcdefghijklmnopqrstuvwxyz0123456789";

    for(var i = 0; i < length; i++)
        identifier += allowedChars.charAt(Math.floor(Math.random() * allowedChars.length));

    return identifier
}
{'fraction_non_alphanumeric': 0.17971334068357223, 'fraction_numerical': 0.011686879823594266, 'mean_word_length': 4.712846347607053, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '1172186', 'n_tokens_mistral': 1551, 'n_tokens_neox': 1430, 'n_words': 387}