Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

rand.h

Go to the documentation of this file.
00001 /*
00002  * rand.h
00003  *
00004  * Pseudo-random number generation, based on OpenBSD arc4random().
00005  *
00006  * Copyright (c) 2000 Dug Song <dugsong@monkey.org>
00007  * Copyright (c) 1996 David Mazieres <dm@lcs.mit.edu>
00008  *
00009  * $Id: rand.h,v 1.4 2002/04/07 19:01:25 dugsong Exp $
00010  */
00011 
00012 #ifndef DNET_RAND_H
00013 #define DNET_RAND_H
00014 
00015 typedef struct rand_handle rand_t;
00016 
00017 __BEGIN_DECLS
00018 rand_t  *rand_open(void);
00019 
00020 int      rand_get(rand_t *r, void *buf, size_t len);
00021 int      rand_set(rand_t *r, const void *seed, size_t len);
00022 int      rand_add(rand_t *r, const void *buf, size_t len);
00023 
00024 uint8_t  rand_uint8(rand_t *r);
00025 uint16_t rand_uint16(rand_t *r);
00026 uint32_t rand_uint32(rand_t *r);
00027 
00028 int      rand_shuffle(rand_t *r, void *base, size_t nmemb, size_t size);
00029 
00030 rand_t  *rand_close(rand_t *r);
00031 __END_DECLS
00032 
00033 #endif /* DNET_RAND_H */

Generated on Sun May 14 14:51:10 2006 by  doxygen 1.4.2