1 rand(S) ____________________________________________________________ _r_a_n_d_,_ _r_a_n_d___r_,_ _s_r_a_n_d_ _-_-_ _s_i_m_p_l_e_ _r_a_n_d_o_m_-_n_u_m_b_e_r_ _g_e_n_e_r_a_t_o_r_ Synopsis #include int rand(void); void srand(unsigned int _s_e_e_d); int rand_r(unsigned int * _s_e_e_d); Description _r_a_n_d uses a multiplicative congruent random-number generator with period 2[32] that returns successive pseudo-random numbers in the range from 0 to _R_A_N_D___M_A_X (defined in _s_t_d_l_i_b_._h). _r_a_n_d___r computes a sequence of pseudo-random integers in the range 0 to _R_A_N_D___M_A_X. If _r_a_n_d___r is called with the same initial value for _s_e_e_d and the value of _s_e_e_d is unchanged between successive returns and calls to _r_a_n_d___r, then the same sequence of random numbers are generated. The function _s_r_a_n_d uses the argument _s_e_e_d as a seed for a new sequence of pseudo-random numbers to be returned by subsequent calls to the function _r_a_n_d. If the function _s_r_a_n_d is then called with the same _s_e_e_d value, the sequence of pseudo-random numbers will be repeated. If the function _r_a_n_d is called before any calls to _s_r_a_n_d have been made, the same sequence will be generated as when _s_r_a_n_d is first called with a _s_e_e_d value of 1. References ddrraanndd4488((SS)) Notices The spectral properties of _r_a_n_d and _r_a_n_d___r are limited. ddrraanndd4488((SS)) provides a much better, though more elaborate, random-number generator. Each thread that accesses one of the functions _d_r_a_n_d_4_8_,_ _l_r_a_n_d_4_8_, _m_r_a_n_d_4_8_,_ _s_r_a_n_d_4_8_,_ _s_e_e_d_4_8, or _l_c_o_n_g_4_8 should be coded as per the following example: mutex_lock(I_am_using_drand48); value = FUNCTION(); mutex_unlock(I_am_using_drand48); where _F_U_N_C_T_I_O_N is one of those listed. The same mutex must be used for all six functions. ____________________________________________________________ ((cc))  22000055  TThhee  SSCCOO  GGrroouupp,,  IInncc..  AAllll  rriigghhttss  rreesseerrvveedd.. _S_C_O_ _O_p_e_n_S_e_r_v_e_r_ _R_e_l_e_a_s_e_ _6_._0_._0_ _-_ _0_1_ _J_u_n_e_ _2_0_0_5