v1
- by seasle 8/28/202000
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
const createKeyGenerator1 = (groupSize, groupCount) => {
    const dictionary = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
    const length = groupSize * groupCount;
    const group = new RegExp(`.{${groupSize}}`, 'g');

    return () => {
        const values = new Uint32Array(length);
        crypto.getRandomValues(values);

        const chars = [...values].map(value => dictionary[value % dictionary.length]);
        const key = '_'
            .repeat(length)
            .replace(/\w/g, (match, index) => chars[index])
            .match(group)
            .join('-');

        return key;
    };
};

const createKeyGenerator2 = (groupSize, groupCount) => {
    const dictionary = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
    const length = groupSize * groupCount;

    return () => {
        const values = new Uint32Array(length);
        crypto.getRandomValues(values);

        const chars = [...values].map(value => dictionary[value % dictionary.length]);
        const key = new Array(groupCount)
            .fill(null)
            .map((_, index) => {
                const offset = index * groupSize;

                return chars
                    .slice(offset, offset + groupSize)
                    .join('')
            })
            .join('-');

        return key;
    };
};

const createKey1 = createKeyGenerator1(4, 3);
const createKey2 = createKeyGenerator2(4, 3);
delete caserun single casemove downdrag and drop case


ready



createKey1();
delete caserun single casemove updrag and drop case


ready



createKey2();
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN