38 #ifndef included_random_h 39 #define included_random_h 71 *seed = (1664525 * *seed) + 1013904223;
98 #ifdef CLIB_LINUX_KERNEL 100 #include <linux/sched.h> 111 #ifdef CLIB_STANDALONE 128 *seed = 6364136223846793005ULL * *seed + 1442695040888963407ULL;
159 u8 *alphabet = (
u8 *)
"abcdefghijklmnopqrstuvwxyz";
164 for (i = 0; i < len; i++)
sll srl srl sll sra u16x4 i
static uword random_default_seed(void)
Default random seed (unix/linux user-mode)
static u64 random_u64(u64 *seed)
64-bit random number generator Again, constants courtesy of Donald Knuth.
static u8 * random_string(u32 *seed, uword len)
Generate random character vector.
#define vec_resize(V, N)
Resize a vector (no header, unspecified alignment) Add N elements to end of given vector V...
static uword random_uword(u32 *seed)
machine word size random number generator
static u32 random_u32_max(void)
Maximum value returned by random_u32()
static f64 random_f64(u32 *seed)
Generate f64 random number in the interval [0,1].
u32 standalone_random_default_seed
int test_random_main(unformat_input_t *input)
static u32 random_u32(u32 *seed)
32-bit random number generator
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".