window.crypto 生成隨機數
阿新 • • 發佈:2020-04-23
https://developer.mozilla.org/zh-CN/docs/Web/API/Window/crypto
https://www.cnblogs.com/vickylinj/p/11956434.html
genRandomNumbers = function getRandomNumbers() { var array = new Uint32Array(10); window.crypto.getRandomValues(array); var randText = document.getElementById("myRandText"); randText.innerHTML = "The random numbers are: " for (var i = 0; i < array.length; i++) { randText.innerHTML += array[i] + " "; } }