Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Provide access to operating system sources of randomness
Branch: master
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test Add smoke test
README Add /dev/urandom code
index.js Add /dev/urandom code
package.json Version=1.0.0



Simple interface to the operating system prng.  Currently only /dev/urandom is supported.
It is assumed that these sources are non-blocking in nature, so therefore sync IO calls
are used by default (async io can be used by passing a callback).

Note: Blocking stat and open calls are used on module load.  It is recommended that you
require the module at least once at init time so as not to block your app later.

This should be extended to call CryptGenRandom on windows which serves the same function
as /dev/urandom.

Quick usage

// Print a buffer synchronously
var osrandom=require('osrandom');

// Use asynchronously
var osrandom=require('osrandom');
osrandom(32, function(err, buffer) {
	if (err) throw err;

Something went wrong with that request. Please try again.