diff options
author | ache <ache@FreeBSD.org> | 2013-07-04 12:35:39 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 2013-07-04 12:35:39 +0000 |
commit | be7c32fd304a8aa87a4cd877782d254092d1282f (patch) | |
tree | 26a34f36229c5a413389f76eddfdf4a04986e680 /lib/libc/stdlib/rand.c | |
parent | e71a9f5bfa78184fcc3776a5603940f09cf23e66 (diff) | |
download | FreeBSD-src-be7c32fd304a8aa87a4cd877782d254092d1282f.zip FreeBSD-src-be7c32fd304a8aa87a4cd877782d254092d1282f.tar.gz |
Style fix noted by bde@
Diffstat (limited to 'lib/libc/stdlib/rand.c')
-rw-r--r-- | lib/libc/stdlib/rand.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/libc/stdlib/rand.c b/lib/libc/stdlib/rand.c index 270e63f..4f4aa8d 100644 --- a/lib/libc/stdlib/rand.c +++ b/lib/libc/stdlib/rand.c @@ -83,12 +83,16 @@ do_rand(unsigned long *ctx) int rand_r(unsigned int *ctx) { - u_long val = (u_long) *ctx; -#ifndef USE_WEAK_SEEDING + u_long val; + int r; + +#ifdef USE_WEAK_SEEDING + val = *ctx; +#else /* Transform to [1, 0x7ffffffe] range. */ - val = (val % 0x7ffffffe) + 1; + val = (*ctx % 0x7ffffffe) + 1; #endif - int r = do_rand(&val); + r = do_rand(&val); #ifdef USE_WEAK_SEEDING *ctx = (unsigned int)val; |