mirror of
https://github.com/LIV2/libnix.git
synced 2025-12-06 00:23:08 +00:00
Merge branch 'devel1'
This commit is contained in:
commit
60007a31b8
@ -1,13 +1,17 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
static unsigned int a=1;
|
||||
static unsigned int a = 1;
|
||||
|
||||
int rand(void)
|
||||
int rand(void) {
|
||||
a = a * 1103515245 + 12345;
|
||||
a = (a >> 16 | a << 16);
|
||||
#if (RAND_MAX==0x7fffffff)
|
||||
{ return (a=a*1103515245+12345)&RAND_MAX; }
|
||||
return a & RAND_MAX;
|
||||
#else
|
||||
{ return (a=a*1103515245+12345)%RAND_MAX; }
|
||||
return a % RAND_MAX;
|
||||
#endif
|
||||
}
|
||||
|
||||
void srand(unsigned int seed)
|
||||
{ a=seed; }
|
||||
void srand(unsigned int seed) {
|
||||
a = seed;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user