npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

random-org-api

v0.0.2

Published

API for accessing random.org within javascript applications.

Readme

#RandomOrgAPI ##Library for accessing Random.org's from within your javascript application. Can be used in both client-side and server-side applications.

Installation

Node

    $ npm install random-org-api
    var RandomOrgAPI = require('random-org-api');

Note: CreateAPI.js is a dependency. While you can find it here: https://github.com/johnhenry/CreateAPI, it should install automatically when you install RandomOrgAPI through npm. If you install it sehparately or manually, it should work fine placed either in RandomOrgAPI's node_modules folder or side-by-side with RandomOrgAPI.

Browser

   <script src="./lib/CreateAPI.js" ></script>
    <!--
    CreatAPI.js is a dependency. 
    You can find it here: https://github.com/johnhenry/CreateAPI/
    -->
   <script src="./lib/RandomOrgAPI.js" ></script>
   <!--Henceforth, you may access the global RandomOrgAPI object...-->

##API Description Each API takes up to three arguments -- parameters, callback, failure

* parameters (optional) - Object containing parameters to be passed to API e.g.
* callback (optional) - Function to be called upon response
    callback is passed the result as a parameter
* failure (optional) - function to be called upon response
    failure is passed the error as a parameter

Each API is based on an API found here: http://www.random.org/#numbers

RandomOrgAPI.integers - creates an array of random integers

parameters

* min - the minimum possible value for the generated integers
    //Default:0
* max - the maximum possible value for the generated integers
    //Default:9
* base - the base in which the numbers generate is returned
    //Default:10
    //Note: Even though random.org will accept a base of 2,4,8,10,or 16
        //Only base 10 is supported
* num - the amount of random numbers generated
    //Default:10

RandomOrgAPI.sequence - creates a randomly ordered array of all integers between two numbers

parameters

* min - the smallest number included
    //Default:0
* max - the largest number included
    //Default:9

RandomOrgAPI.integerSet - creates an list of sets of integers

parameters

* min - the minimum possible value for the generated integers
    //Default:0
* max - the maximum possible value for the generated integers
    //Default:10
* num - the amount of integers per set
* sets - the amount of sets generated
    //Default:10

RandomOrgAPI.decimalFractions - creates an list random numbers between 0 and 1

parameters

* dec - the decimal precision of each number
    //Default:10
* num - the amount of numbers generated
    //Default:10

RandomOrgAPI.gaussianDistributions - creates a list of random numbers that satisfy a given guassian distribution

parameters

* mean - the mean of the given guassian distribution
    //Default:0
* stdev - the standard deviation of the given guassian distribution
    //Default:1
* dec - the decimal precision of each number
    //Default:10
* num - the amount of numbers generated
    //Default:10

RandomOrgAPI.bytes - creates random bytes

parameters

* nbytes - the number of bytes to be generated
    //Default:8

##Example The following example creates a variable named "die" and then assigns a random integer between 1 and 6 (inclusive) to it's value.

var die;
RandomOrgAPI.integer({min:1,max:6,num:1},function(result){console.log(die = result[0])});
```js

## License

(The MIT License)

Copyright (c) 2013 John Henry &lt;[email protected]&gt;

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.