Use arc4random() instead of random()

This commit is contained in:
Brian Somers 2000-08-31 00:45:24 +00:00
parent 3e755f76d1
commit 8507c35e67
2 changed files with 9 additions and 1 deletions

View File

@ -53,10 +53,11 @@
#define issep(c) ((c) == '\t' || (c) == ' ')
#if defined(__NetBSD__) || __FreeBSD__ < 3
void
randinit()
{
#if defined(__OpenBSD__) || __FreeBSD__ >= 3
#if defined(__FreeBSD__)
static int initdone; /* srandomdev() call is only required once */
if (!initdone) {
@ -67,6 +68,7 @@ randinit()
srandom((time(NULL)^getpid())+random());
#endif
}
#endif
ssize_t
fullread(int fd, void *v, size_t n)

View File

@ -102,7 +102,13 @@
#define ROUNDUP(x) ((x) ? (1 + (((x) - 1) | (sizeof(long) - 1))) : sizeof(long))
#if defined(__NetBSD__) || __FreeBSD__ < 3
extern void randinit(void);
#else
#define random arc4random
#define randinit()
#endif
extern ssize_t fullread(int, void *, size_t);
extern const char *mode2Nam(int);
extern int Nam2mode(const char *);