1.0.2 • Published 4 years ago
qrandom v1.0.2
qrandom
Get true random numbers generated by measuring the quantum fluctuations of the vacuum in a lab at the Australian National University.
Installation
Global
npm i -g qrandom
Local
npm i qrandom
Usage
Cli
qrandom -t -l -s
-t
Sets the desired data typeuint8
uint16
hex16
-l
Defines the length of the response array (min 1, max 1024, default 10)-s
To be used only when data type ===hex16
. Defines the block size for the hex values (min 1, max 1024, default 10)
API
const quantumRandom = require('qrandom');
// Parameters: data-type, array-length, block-size, callback
quantumRandom('hex16', 10, 10, (error, data) => {
if (error) return console.error(error);
console.log(data.toString());
}
// To get a Promise instead just don't pass a callback parameter
quantumRandom('hex16', 10, 10)
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
// Or
await quantumRandom('hex16', 10, 10);