uniform               package:rlecuyer               R Documentation

_G_e_n_e_r_a_t_e _r_a_n_d_o_m _n_u_m_b_e_r_s

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

     '.lec.uniform' generates U(0,1) random numbers.

     '.lec.uniform.int' generates random numbers from the discrete
     uniform distribution over integers.

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

     .lec.uniform (name, n = 1)

     .lec.uniform.int (name, n = 1, a = 0, b = 10)

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

    name: name of the stream.

       n: number of random numbers to be generated.

     a,b: interval from which the integer random numbers should be
          generated.

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

     '.lec.uniform' and '.lec.uniform.int', respectively, are wrapper
     functions for the C functions 'RngStream_RandU01' and
     'RngStream_RandInt', respectively (L'Ecuyer et al, 2002). 

     Note: Since the stream is here identified by 'name', there is no
     need for using the 'CurrentStream' pair.

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

     A vector of n random numbers.

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

     P. L'Ecuyer, R. Simard, E.J.Chen and W.D.Kelton: An
     Object-Oriented Random-Number Package With Many Long Streams and
     Substreams; Operations Research, vol. 50, nr. 6, 2002.

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

     '.lec.CurrentStream'

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

     nstreams <- 10       # number of streams
     seed<-rep(1,6)
     .lec.SetPackageSeed(seed)
     names <- paste("mystream",1:nstreams,sep="")
     .lec.CreateStream(names)
     for (i in 1:nstreams)   # generate 10 RNs from each stream
           print(.lec.uniform(names[i],10))
     .lec.DeleteStream(names)

