openbsd-ports/security/pwgen/patches/patch-randnum_c

25 lines
518 B
Plaintext

$OpenBSD: patch-randnum_c,v 1.3 2008/04/22 09:15:08 robert Exp $
--- randnum.c.orig Thu Jul 5 01:42:19 2007
+++ randnum.c Tue Apr 22 11:12:27 2008
@@ -17,6 +17,15 @@
#include "pwgen.h"
+#ifdef HAVE_ARC4RANDOM
+
+int pw_random_number(int max_num)
+{
+ return (arc4random_uniform(max_num));
+}
+
+#else
+
#ifdef HAVE_DRAND48
extern double drand48(void);
#endif
@@ -93,3 +102,4 @@ int pw_random_number(max_num)
return ((int) (random() / ((float) RAND_MAX) * max_num));
#endif
}
+#endif /* HAVE_ARC4RANDOM */