docs: function getRNG(){
  	var randomBits, crypto;
  	
  	function construct(bits, arr, radix, size){
  		var str = '',
  			i = 0,
  			len = arr.length-1;
  		while( i<len || (str.length < bits) ){
  			str += padLeft(parseInt(arr[i], radix).toString(2), size);
  			i++;
  		}
  		str = str.substr(-bits);
  		if( (str.match(/0/g)||[]).length === str.length){ // all zeros?
  			return null;
  		}else{
  			return str;
  		}
  	}
  	
  	// node.js crypto.randomBytes()
  	if(typeof require === 'function' && (crypto=require('crypto')) && (randomBits=crypto['randomBytes'])){
  		return function(bits){
  			var bytes = Math.ceil(bits/8),
  				str = null;
  		
  			while( str === null ){
  				str = construct(bits, randomBits(bytes).toString('hex'), 16, 4);
  			}
  			return str;
  		}
  	}
  	
  	// browsers with window.crypto.getRandomValues()
  	if(global['crypto'] && typeof global['crypto']['getRandomValues'] === 'function' && typeof global['Uint32Array'] === 'function'){
  		crypto = global['crypto'];
  		return function(bits){
  			var elems = Math.ceil(bits/32),
  				str = null,
  				arr = new global['Uint32Array'](elems);
  
  			while( str === null ){
  				crypto['getRandomValues'](arr);
  				str = construct(bits, arr, 10, 32);
  			}
  			
  			return str;	
  		}
  	}
  
  	// A totally insecure RNG!!! (except in Safari)
  	// Will produce a warning every time it is called.
  	config.unsafePRNG = true;
  	warn();
  	
  	var bitsPerNum = 32;
  	var max = Math.pow(2,bitsPerNum)-1;
  	return function(bits){
  		var elems = Math.ceil(bits/bitsPerNum);
  		var arr = [], str=null;
  		while(str===null){
  			for(var i=0; i<elems; i++){
  				arr[i] = Math.floor(Math.random() * max + 1); 
  			}
  			str = construct(bits, arr, 10, bitsPerNum);
  		}
  		return str;
  	};
  }