Answers for "generate random hex string"

0

generate random hex string

function genHexString(len) {
    const hex = '0123456789ABCDEF';
    let output = '';
    for (let i = 0; i < len; ++i) {
        output += hex.charAt(Math.floor(Math.random() * hex.length));
    }
    return output;
}
Posted by: Guest on May-02-2021

Code answers related to "generate random hex string"

Browse Popular Code Answers by Language