提交 0996faa3 编写于 作者: S Szabolcs Nagy

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.
上级 c79cd27e
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
uint64_t __rand48_step(unsigned short *xi, unsigned short *lc)
{
......
......@@ -2,5 +2,5 @@
int rand_r(unsigned *seed)
{
return (*seed = *seed * 1103515245 + 12345) & 0x7fffffff;
return (*seed = *seed * 1103515245 + 12345)/2;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册