This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Crypto PseudoRandom Shuffle: one right way to randomize, esp for gaming | |
| // https://replit.com/@jeremybradbury/CSPRNG-Fisher-Yeats-Shuffle | |
| // NodeJS - CJS version (backward comaptible) | |
| const crypto = require("crypto"); | |
| // the secret sauce | |
| const getRndInt = (bytes) => | |
| parseFloat( | |
| parseFloat(crypto.randomBytes(bytes).toString("hex"), 16).toString(10), | |
| 10 |
OlderNewer