rand.h revision dd2cfe1134f0c44f42dea33b110f9d2310618e0d
* Generate a 32-bit signed random number. * @returns The random number. * Generate a 32-bit unsigned random number in the set [u32First..u32Last]. * @returns The random number. * @param u32First First number in the set. * @param u32Last Last number in the set. * Generate a 32-bit unsigned random number. * @returns The random number. * Generate a 64-bit signed random number in the set [i64First..i64Last]. * @returns The random number. * @param i64First First number in the set. * @param i64Last Last number in the set. * Generate a 64-bit signed random number. * @returns The random number. * Generate a 64-bit unsigned random number in the set [u64First..u64Last]. * @returns The random number. * @param u64First First number in the set. * @param u64Last Last number in the set. * Generate a 64-bit unsigned random number. * @returns The random number. * Create an instance of the default random number generator. * @returns IPRT status code. * @param phRand Where to return the handle to the new random number * Create an instance of the default pseudo random number generator. * @returns IPRT status code. * @param phRand Where to store the handle to the generator. * Create an instance of the Park-Miller pseudo random number generator. * @returns IPRT status code. * @param phRand Where to store the handle to the generator. * Create an instance of the faster random number generator for the OS. * @returns IPRT status code. * @retval VERR_NOT_SUPPORTED on platforms which doesn't have this feature. * @retval VERR_FILE_NOT_FOUND on system where the random generator hasn't * been installed or configured correctly. * @retval VERR_PATH_NOT_FOUND for the same reasons as VERR_FILE_NOT_FOUND. * @param phRand Where to store the handle to the generator. * Create an instance of the openssl random number generator. * @returns IPRT status code. * @retval VERR_NOT_SUPPORTED on platforms which doesn't have this feature. * @param phRand Where to store the handle to the generator. * Create an instance of the truer random number generator for the OS. * Don't use this unless you seriously need good random numbers because most * systems will have will have problems producing sufficient entropy for this * and you'll end up blocking while it accumulates. * @returns IPRT status code. * @retval VERR_NOT_SUPPORTED on platforms which doesn't have this feature. * @retval VERR_FILE_NOT_FOUND on system where the random generator hasn't * been installed or configured correctly. * @retval VERR_PATH_NOT_FOUND for the same reasons as VERR_FILE_NOT_FOUND. * @param phRand Where to store the handle to the generator. * Destroys a random number generator. * @returns IPRT status code. * @param hRand Handle to the random number generator. * Generic method for seeding of a random number generator. * The different generators may have specialized methods for * seeding, use one of those if you desire better control * @returns IPRT status code. * @retval VERR_NOT_SUPPORTED if it isn't a pseudo generator. * @param hRand Handle to the random number generator. * Save the current state of a pseudo generator. * This can be use to save the state so it can later be resumed at the same * @returns IPRT status code. * @retval VINF_SUCCESS on success. *pcbState contains the length of the * returned string and pszState contains the state string. * @retval VERR_BUFFER_OVERFLOW if the supplied buffer is too small. *pcbState * will contain the necessary buffer size. * @retval VERR_NOT_SUPPORTED by non-psuedo generators. * @param hRand Handle to the random number generator. * @param pszState Where to store the state. The returned string will be * null terminated and printable. * @param pcbState The size of the buffer pszState points to on input, the * size required / used on return (including the * terminator, thus the 'cb' instead of 'cch'). * Restores the state of a pseudo generator. * The state must have been obtained using RTRandAdvGetState. * @returns IPRT status code. * @retval VERR_PARSE_ERROR if the state string is malformed. * @retval VERR_NOT_SUPPORTED by non-psuedo generators. * @param hRand Handle to the random number generator. * @param pszState The state to load. * Fills a buffer with random bytes. * @param hRand Handle to the random number generator. * @param pv Where to store the random bytes. * @param cb Number of bytes to generate. * Generate a 32-bit signed random number in the set [i32First..i32Last]. * @returns The random number. * @param hRand Handle to the random number generator. * @param i32First First number in the set. * @param i32Last Last number in the set. * Generate a 32-bit signed random number. * @returns The random number. * @param hRand Handle to the random number generator. * Generate a 32-bit unsigned random number in the set [u32First..u32Last]. * @returns The random number. * @param hRand Handle to the random number generator. * @param u32First First number in the set. * @param u32Last Last number in the set. * Generate a 32-bit unsigned random number. * @returns The random number. * @param hRand Handle to the random number generator. * Generate a 64-bit signed random number in the set [i64First..i64Last]. * @returns The random number. * @param hRand Handle to the random number generator. * @param i64First First number in the set. * @param i64Last Last number in the set. * Generate a 64-bit signed random number. * @returns The random number. * Generate a 64-bit unsigned random number in the set [u64First..u64Last]. * @returns The random number. * @param hRand Handle to the random number generator. * @param u64First First number in the set. * @param u64Last Last number in the set. * Generate a 64-bit unsigned random number. * @returns The random number. * @param hRand Handle to the random number generator.