musl - musl - an implementation of the standard library for Linux-based systems

index : musl
musl - an implementation of the standard library for Linux-based systems
summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorSzabolcs Nagy <nsz@port70.net>2013年06月08日 13:49:12 +0000
committerSzabolcs Nagy <nsz@port70.net>2013年06月08日 13:49:12 +0000
commit0996faa3d789dd69e4c1c022757f0623908b0df5 (patch)
tree78e677b1897dc9013023fdc0f3d98daade8a7625 /src
parentc79cd27e9e81eb5e223728094f1233ee2fc12dda (diff)
downloadmusl-0996faa3d789dd69e4c1c022757f0623908b0df5.tar.gz
prng: make rand_r have 2^32 period instead of 2^31
this is a minor fix to increase the period of the obsolete rand_r a bit. an include header in __rand48_step.c is fixed as well.
Diffstat (limited to 'src')
-rw-r--r--src/prng/__rand48_step.c 2
-rw-r--r--src/prng/rand_r.c 2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/prng/__rand48_step.c b/src/prng/__rand48_step.c
index 755b4f2f..105f810f 100644
--- a/src/prng/__rand48_step.c
+++ b/src/prng/__rand48_step.c
@@ -1,5 +1,5 @@
#include <stdlib.h>
-#include <inttypes.h>
+#include <stdint.h>
uint64_t __rand48_step(unsigned short *xi, unsigned short *lc)
{
diff --git a/src/prng/rand_r.c b/src/prng/rand_r.c
index e96cfba9..ef26dbde 100644
--- a/src/prng/rand_r.c
+++ b/src/prng/rand_r.c
@@ -2,5 +2,5 @@
int rand_r(unsigned *seed)
{
- return (*seed = *seed * 1103515245 + 12345) & 0x7fffffff;
+ return (*seed = *seed * 1103515245 + 12345)/2;
}
generated by cgit v1.2.1 (git 2.18.0) at 2025年10月08日 19:20:52 +0000

AltStyle によって変換されたページ (->オリジナル) /