NDEVR
API Documentation
openbsd.h
1#ifndef ARC4RANDOM_H_INCLUDED
2#define ARC4RANDOM_H_INCLUDED
3
4#include <cstdlib> /* srand, rand */
5#include <cstddef>
6#include <cstring>
7#include <ctime>
8
9inline
10void arc4random_buf(void *buf, size_t nbytes)
11{
12
13 for( size_t n = 0; n < nbytes; ++ n)
14 ((char*)(buf))[n] = rand() %256;
15}
16
17inline
18void arc4random_init(void)
19{
20 srand( (unsigned int) time(NULL));
21}
22
23
24#endif // ARC4RANDOM_H_INCLUDED