Initialize random number generator in main

The random number generator can be initialized when MaxScale's other
systems are being initialized. This removes the need to initialized it
when the function is used for the first time.
This commit is contained in:
Markus Mäkelä
2017-02-08 16:42:35 +02:00
parent fdcc9333c8
commit 334e71b079
3 changed files with 50 additions and 58 deletions

View File

@ -16,6 +16,20 @@
MXS_BEGIN_DECLS
extern unsigned int random_jkiss(void);
/**
* @brief Initialize the random number generator
*
* Uses /dev/urandom if available, and warms the generator up with 1000 iterations.
*/
void random_jkiss_init(void);
/**
* @brief Return a pseudo-random number
*
* Return a pseudo-random number that satisfies major tests for random sequences.
*
* @return A random number
*/
unsigned int random_jkiss(void);
MXS_END_DECLS