diff options
Diffstat (limited to 'newlib/libc/stdlib/rand.c')
-rw-r--r-- | newlib/libc/stdlib/rand.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/newlib/libc/stdlib/rand.c b/newlib/libc/stdlib/rand.c index a085ef37c..4f5a60796 100644 --- a/newlib/libc/stdlib/rand.c +++ b/newlib/libc/stdlib/rand.c @@ -72,7 +72,7 @@ on two different systems. void _DEFUN (srand, (seed), unsigned int seed) { - _REENT->_new._reent._rand_next = seed; + _REENT_RAND_NEXT(_REENT) = seed; } int @@ -81,9 +81,10 @@ _DEFUN_VOID (rand) /* This multiplier was obtained from Knuth, D.E., "The Art of Computer Programming," Vol 2, Seminumerical Algorithms, Third Edition, Addison-Wesley, 1998, p. 106 (line 26) & p. 108 */ - _REENT->_new._reent._rand_next = - _REENT->_new._reent._rand_next * __extension__ 6364136223846793005LL + 1; - return (int)((_REENT->_new._reent._rand_next >> 32) & RAND_MAX); + _REENT_CHECK_RAND48(_REENT); + _REENT_RAND_NEXT(_REENT) = + _REENT_RAND_NEXT(_REENT) * __extension__ 6364136223846793005LL + 1; + return (int)((_REENT_RAND_NEXT(_REENT) >> 32) & RAND_MAX); } #endif /* _REENT_ONLY */ |