xuanxu edited this page Aug 19, 2010 · 4 revisions
Clone this wiki locally

Random Sources is a Ruby gem that provides genuine random numbers, generated by processes fundamentally governed by inherent uncertainty instead of some pseudo-random number algorithm. It uses HTTP services from different online providers.

Getting started

Install the gem:

$ [sudo] gem install random_sources

Then depending on your project you may:

Require the gem (if a ruby project):

require 'random_sources'

or add it to your Gemfile (if you’re on Rails):
gem 'random_sources', :git => 'git://github.com/xuanxu/random_sources.git'


Your entry point is the RandomSources module. With it you can get a list of supported providers and instantiate any of them:

RandomSources.list                   #=> "HotBits, RandomOrg"
RandomSources.generator 'RandomOrg'  #=> <RandomSources::RandomOrg>

List of supported providers

The current version includes two online sources. Each of them is managed by its own class.

Usually the provider assigns a quota of bits per day and IP, so use it properly and check the conditions of use in their websites.