40 for (i = 0; i < 256; i++)
42 for (i = j = 0; i < 256; i++)
44 j +=
s[i] + seedp[i %
sizeof seed];
61 for (
buf = buf_; size-- > 0;
buf++)
static char buf[BUF_SIZE]
unsigned long random_ulong(void)
Returns a pseudo-random unsigned long.
void random_bytes(void *buf_, size_t size)
Writes SIZE random bytes into BUF.
static bool inited
Already initialized?
static void swap_byte(uint8_t *a, uint8_t *b)
Swaps the bytes pointed to by A and B.
void random_init(unsigned seed)
Initializes or reinitializes the PRNG with the given SEED.
static uint8_t s[256]
RC4-based pseudo-random number generator (PRNG).