Skip to content

Instantly share code, notes, and snippets.

@merickson
Created February 24, 2013 21:23
Show Gist options
  • Save merickson/5025703 to your computer and use it in GitHub Desktop.
Save merickson/5025703 to your computer and use it in GitHub Desktop.
Same JS randomness HTML
<html>
<head>
<title>foo</title>
</head>
<body>
<span id='output'>foo</span>
<script type="text/javascript">
/* assuming that window.crypto.getRandomValues is available */
var data = document.getElementById('output');
var array = new Uint32Array(1);
window.crypto.getRandomValues(array);
console.log(array[0]);
data.innerHTML = array[0];
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment