📜  生成随机十六进制字符串 - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:58.682000             🧑  作者: Mango

代码示例1
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;
}