乱姉ちゃん
32バイトの乱数を生成してくれるやつ
下記コードを実行
code:main.js
function getRandom() {
const random = crypto.getRandomValues(new Uint8Array(32))
$('#container').empty()
$('#container').append(`
<table border="1">
<tr>
<td>random</td>
<td style="font-family:monospace;">${buf2hexStr(random.buffer)}</td>
</tr>
</table>
<button onclick="getRandom()">reload</button>
`)
}
function buf2hexStr(buffer) {
return Array.from(new Uint8Array(buffer))
.map(x => x.toString(16).padStart(2, "0"))
.join("")
}
(async () => {
await loadScript("./libs/jquery/jquery-3.6.3.min.js")
getRandom()
})()