summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/rand.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdlib/rand.c')
-rw-r--r--lib/libc/stdlib/rand.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/libc/stdlib/rand.c b/lib/libc/stdlib/rand.c
index 0f9c100807f..6860dd4f712 100644
--- a/lib/libc/stdlib/rand.c
+++ b/lib/libc/stdlib/rand.c
@@ -39,14 +39,29 @@ rand_r(u_int *seed)
return (*seed % ((u_int)RAND_MAX + 1));
}
+#if defined(APIWARN)
+__warn_references(rand_r,
+ "warning: rand_r() isn't random; consider using arc4random()");
+#endif
+
int
rand(void)
{
return (rand_r(&next));
}
+#if defined(APIWARN)
+__warn_references(rand,
+ "warning: rand() isn't random; consider using arc4random()");
+#endif
+
void
srand(u_int seed)
{
next = seed;
}
+
+#if defined(APIWARN)
+__warn_references(srand,
+ "warning: srand() seed choices are invariably poor");
+#endif