diff options
Diffstat (limited to 'src/lib/libc/stdlib/rand.c')
-rw-r--r-- | src/lib/libc/stdlib/rand.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/libc/stdlib/rand.c b/src/lib/libc/stdlib/rand.c index 0f9c100807..6860dd4f71 100644 --- a/src/lib/libc/stdlib/rand.c +++ b/src/lib/libc/stdlib/rand.c | |||
@@ -39,14 +39,29 @@ rand_r(u_int *seed) | |||
39 | return (*seed % ((u_int)RAND_MAX + 1)); | 39 | return (*seed % ((u_int)RAND_MAX + 1)); |
40 | } | 40 | } |
41 | 41 | ||
42 | #if defined(APIWARN) | ||
43 | __warn_references(rand_r, | ||
44 | "warning: rand_r() isn't random; consider using arc4random()"); | ||
45 | #endif | ||
46 | |||
42 | int | 47 | int |
43 | rand(void) | 48 | rand(void) |
44 | { | 49 | { |
45 | return (rand_r(&next)); | 50 | return (rand_r(&next)); |
46 | } | 51 | } |
47 | 52 | ||
53 | #if defined(APIWARN) | ||
54 | __warn_references(rand, | ||
55 | "warning: rand() isn't random; consider using arc4random()"); | ||
56 | #endif | ||
57 | |||
48 | void | 58 | void |
49 | srand(u_int seed) | 59 | srand(u_int seed) |
50 | { | 60 | { |
51 | next = seed; | 61 | next = seed; |
52 | } | 62 | } |
63 | |||
64 | #if defined(APIWARN) | ||
65 | __warn_references(srand, | ||
66 | "warning: srand() seed choices are invariably poor"); | ||
67 | #endif | ||