Skip to content

Instantly share code, notes, and snippets.

@mfcodeworks
Last active November 27, 2019 08:25
Show Gist options
  • Save mfcodeworks/b366234e33363e33467a956886498c09 to your computer and use it in GitHub Desktop.
Save mfcodeworks/b366234e33363e33467a956886498c09 to your computer and use it in GitHub Desktop.
const secureMathRandom = () => {
// Divide a random UInt32 by the maximum value (2^32 -1) to get a result between 0 and 1
return window.crypto.getRandomValues(new Uint32Array(1))[0] / 4294967295;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment