random.h File Reference
Detailed Description
Random.
Definition in file random.h.
#include "generic.h"
Go to the source code of this file.
Functions | |
Setting and reading the state | |
VL_EXPORT void | vl_rand_set_state (vl_uint32 const state[625]) |
Write the state of the random number generator. | |
VL_EXPORT void | vl_rand_get_state (vl_uint32 *state) |
Write the state of the random number generator. | |
VL_EXPORT void | vl_rand_seed (vl_uint32 s) |
Seed the state of the random number generator. | |
VL_EXPORT void | vl_rand_seed_by_array (vl_uint32 const init_key[], int key_length) |
Seed the state of the random number generator by an array. | |
Generate random numbers | |
VL_EXPORT vl_uint32 | vl_rand_uint32 () |
Generate a random UINT32. | |
VL_EXPORT vl_int32 | vl_rand_int31 () |
Generate a random INT31. | |
VL_EXPORT double | vl_rand_real1 () |
Generate a random number in [0,1]. | |
VL_EXPORT double | vl_rand_real2 () |
Generate a random number in [0,1). | |
VL_EXPORT double | vl_rand_real3 () |
Generate a random number in (0,1). | |
VL_EXPORT double | vl_rand_res53 () |
Generate a random number in [0,1) with 53-bit resolution. |
Function Documentation
VL_EXPORT void vl_rand_get_state | ( | vl_uint32 * | state | ) |
- Parameters:
-
state pointer to an array of 625 numbers.
VL_EXPORT vl_int32 vl_rand_int31 | ( | ) |
- Returns:
- a random number in [0, 0x7fffffff].
Definition at line 204 of file random.c.
References vl_rand_uint32().
VL_EXPORT double vl_rand_real1 | ( | ) |
VL_EXPORT double vl_rand_real2 | ( | ) |
VL_EXPORT double vl_rand_real3 | ( | ) |
VL_EXPORT double vl_rand_res53 | ( | ) |
VL_EXPORT void vl_rand_seed | ( | vl_uint32 | s | ) |
- Parameters:
-
s seed.
Definition at line 110 of file random.c.
Referenced by vl_rand_seed_by_array(), and vl_rand_uint32().
VL_EXPORT void vl_rand_seed_by_array | ( | vl_uint32 const | init_key[], | |
int | key_length | |||
) |
- Parameters:
-
init_key array of numbers. key_length length of the array.
Definition at line 132 of file random.c.
References vl_rand_seed().
VL_EXPORT void vl_rand_set_state | ( | vl_uint32 const | state[625] | ) |
VL_EXPORT vl_uint32 vl_rand_uint32 | ( | ) |
- Returns:
- a random number in [0, 0xffffffff].
Definition at line 162 of file random.c.
References vl_rand_seed().
Referenced by vl_ikm_init_rand(), vl_ikm_init_rand_data(), vl_rand_int31(), vl_rand_real1(), vl_rand_real2(), vl_rand_real3(), and vl_rand_res53().