RAND_bytes(3) OpenSSL RAND_bytes(3) NNAAMMEE RAND_bytes, RAND_pseudo_bytes - generate random data SSYYNNOOPPSSIISS #include int RAND_bytes(unsigned char *buf, int num); int RAND_pseudo_bytes(unsigned char *buf, int num); DDEESSCCRRIIPPTTIIOONN _R_A_N_D___b_y_t_e_s_(_) puts nnuumm cryptographically strong pseudo-random bytes into bbuuff. An error occurs if the PRNG has not been seeded with enough ran- domness to ensure an unpredictable byte sequence. _R_A_N_D___p_s_e_u_d_o___b_y_t_e_s_(_) puts nnuumm pseudo-random bytes into bbuuff. Pseudo-ran- dom byte sequences generated by _R_A_N_D___p_s_e_u_d_o___b_y_t_e_s_(_) will be unique if they are of sufficient length, but are not necessarily unpredictable. They can be used for non-cryptographic purposes and for certain pur- poses in cryptographic protocols, but usually not for key generation etc. The contents of bbuuff is mixed into the entropy pool before retrieving the new pseudo-random bytes unless disabled at compile time (see FAQ). RREETTUURRNN VVAALLUUEESS _R_A_N_D___b_y_t_e_s_(_) returns 1 on success, 0 otherwise. The error code can be obtained by _E_R_R___g_e_t___e_r_r_o_r(3). _R_A_N_D___p_s_e_u_d_o___b_y_t_e_s_(_) returns 1 if the bytes generated are cryptographically strong, 0 otherwise. Both func- tions return -1 if they are not supported by the current RAND method. SSEEEE AALLSSOO _r_a_n_d(3), _E_R_R___g_e_t___e_r_r_o_r(3), _R_A_N_D___a_d_d(3) HHIISSTTOORRYY _R_A_N_D___b_y_t_e_s_(_) is available in all versions of SSLeay and OpenSSL. It has a return value since OpenSSL 0.9.5. _R_A_N_D___p_s_e_u_d_o___b_y_t_e_s_(_) was added in OpenSSL 0.9.5. 1.0.1u 2016-09-22 RAND_bytes(3)