trueRandom             package:accuracy             R Documentation

_F_u_n_c_t_i_o_n _t_o _r_e_t_u_r_n _T_R_U_E (_n_o_t _p_s_e_u_d_o) _r_a_n_d_o_m _n_u_m_b_e_r_s, _b_a_s_e_d _o_n _s_y_s_t_e_m _a_n_d _n_e_t_w_o_r_k_e_d _e_n_t_r_o_p_y _c_o_l_l_e_c_t_i_o_n.

_D_e_s_c_r_i_p_t_i_o_n:

     This function makes use of hardware-generated entropy to supply 
     true random numbers. Entropy collection is slow, so its primary
     use to provide random numbers for cryptographic key generation and
     for setting  the seed value for subsequent PRNG generation.

_U_s_a_g_e:

             runifT(n,min=0,max=1)
             resetSeed()
             initPool(size=512, hbok=TRUE, devrndok=TRUE, silent=FALSE) 

_A_r_g_u_m_e_n_t_s:

       n: number of observations. If 'length(n) > 1', the length is
          taken to be the number required. 

 min,max: lower and upper limits of the distribution 

    size: number of bytes of entropy to be retrieved into the local
          entropy pool

    hbok: use the "hotbits" entropy server 

  silent: do not issue warnings 

devrndok: use /dev/random on Unix-derived systems 

_D_e_t_a_i_l_s:

     'runifT' returns true random numbers in a uniform distribution.

     'resetSeed' resets R's own PRNG seed, 'set.seed', supplying a true
     random number

     'initPool' provides lower level control over how the external
     entropy sources used by 'runifT' and 'resetSeed' are accessed

     These routines  provides true random numbers by accessing external
     entropy collectors. Currently entropy can be retrieved from two
     different sources. (1) The "Hotbits" server <URL:
     http://www.fourmilab.ch/hotbits/> supplies random bytes based on
     radioactive decay. (2) On Unix systems, the the  kernel gathers
     environmental noise from device drivers and other sources into an
     entropy  pool, which can be accessed through '/dev/random'.

     By default, /dev/random will be preferred, if available, with
     hotbits used only if /dev/random is not found. In addition,
     entropy will be requested from the external sources in 512byte
     blocks (runifT will automatically request more blocks if necessary
     to satisfy a request). Use initPool to change the source and block
     size.

_V_a_l_u_e:

     'runifT'   Returns a vector of uniformly distributed true random
     numbers. 'resetSeed' returns the status of 'set.seed()'

_A_u_t_h_o_r(_s):

     Micah Altman Micah_Altman@harvard.edu <URL:
     http://www.hmdc.harvard.edu/micah_altman/>

_R_e_f_e_r_e_n_c_e_s:

     Altman, M., J. Gill and M. P. McDonald.  2003.  _Numerical Issues
     in Statistical Computing for the Social Scientist_.  John Wiley &
     Sons. <URL: http://www.hmdc.harvard.edu/numerical_issues/>

_S_e_e _A_l_s_o:

     See Also  'runif', '.Random.seed',

_E_x_a_m_p_l_e_s:

     # note, if you are using Windows, you must be on-line
     # to get to entropy generator, will fall-back to pseudo-random
     # numbers when off-line

     # only needed  to pass R CMD check on online windows
     w = options("warn");
     options(warn=0);

     # reset the seed for runif() based on a true random value

     resetSeed()
     y=runif(100)

     # generate true random values directly (may block for long periods if 
     # if entropy pool is empty)

     y=runifT(1000)
     ty= table(trunc(5*y))
     print(ty);
     chisq.test(ty)
     options(warn=as.integer(w));

