w1nk / arc4random

Native bindings for the arc4random() family of funcitons.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

arc4random

Native bindings for the arc4random() family of funcitons:

  • arc4random()
  • arc4random_buf(buf, nbytes)
  • arc4random_uniform(upper_bound)

Requirements

Installation

The latest and greatest version of this software is available through npm.

npm install arc4random

Usage

var rng = require('arc4random');

// returns an integer in the range [0, 2^32)
var randomNumber = rng.arc4random();

// stores nbytes integers in the given buffer.
// each byte is an integer in the range [0, 256)
var nbytes = 255;
var buf = new Buffer(nbytes);
rng.arc4random_buf(buf, nbytes);

// returns an integer in the range [0, upper_bound)
var anotherRandomNumber = rng.arc4random_uniform(16);

License

See LICENSE.md

About

Native bindings for the arc4random() family of funcitons.

License:ISC License


Languages

Language:JavaScript 67.7%Language:C++ 24.9%Language:Python 7.3%