How to use brorand - 6 common examples

To help you get started, we’ve selected a few brorand examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / brorand / brorand-tests.ts View on Github external
import * as brorand from 'brorand';

{
	let result: Buffer|Uint8Array = brorand(42);
}

{
	let Rand = new brorand.Rand({getByte: () => 255});
	let rand: {getByte: () => number} = Rand.rand;
	let result: Buffer|Uint8Array = Rand.generate(42);
}
github bfwg / angular-spring-starter / frontend / node_modules / miller-rabin / lib / mr.js View on Github external
function MillerRabin(rand) {
  this.rand = rand || new brorand.Rand();
}
module.exports = MillerRabin;
github indutny / self-signed / lib / kg.js View on Github external
function KeyGen(options) {
  this.options = options || {};
  this.rand = new brorand.Rand(this.options.prng);
  this.primal = primal.create({ 'miller-rabin': this.rand });
}
module.exports = KeyGen;
github jenkins-infra / evergreen / distribution / client / src / lib / rand-patch.ts View on Github external
/*
 * This is to patch stupid behavior by brorand
 * (https://github.com/indutny/brorand)
 * which is used underneath elliptic for generating keys.
 *
 * It seems to not believe that we're in nodejs when we really are
 */

import crypto from 'crypto';
import rand from 'brorand';

rand.Rand.prototype._rand = function _rand(n) {
  return crypto.randomBytes(n);
};
github sx1989827 / DOClever / Desktop / node_modules / miller-rabin / lib / mr.js View on Github external
function MillerRabin(rand) {
  this.rand = rand || new brorand.Rand();
}
module.exports = MillerRabin;

brorand

Random number generator for browsers and node.js

MIT
Latest version published 8 years ago

Package Health Score

65 / 100
Full package analysis

Popular brorand functions