[Node.js Home][Home]
Fortuna is a pseduo-random number generator and which generates secure pseudorandom numbers. Fortuna was created in 2003 by Bruce Schneier and Niels Ferguson.
Node.js Fortuna Random Number
[Node.js Home][Home]
Fortuna is a pseduo-random number generator and which generates secure pseudorandom numbers. Fortuna was created in 2003 by Bruce Schneier and Niels Ferguson.
|
Some sample code:
var entropy = require('string-entropy'); const fortuna = require('javascript-fortuna'); const args = process.argv.slice(3); n = args[0]; fortuna.init(); const min = 0; const max = 255; var randomstr=""; for (i = 0; i < n; i++) { const ran = parseInt((fortuna.random() * (max - min)) + min); //randomstr += ""+String.fromCharCode(ran); randomstr += " "+ran; } console.log("Random values:\t",randomstr); //console.log("Entropy:\t",entropy(randomstr));