mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 14:30:57 +00:00
29 lines
400 B
C
29 lines
400 B
C
#include <stdlib.h>
|
|
|
|
#if defined(__GNUC__)
|
|
static unsigned long long next = 0;
|
|
#else
|
|
static unsigned __int64 next = 0;
|
|
#endif
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
int __cdecl rand(void)
|
|
{
|
|
#if defined(__GNUC__)
|
|
next = next * 0x5deece66dLL + 11;
|
|
#else
|
|
next = next * 0x5deece66di64 + 11;
|
|
#endif
|
|
return (int)((next >> 16) & RAND_MAX);
|
|
}
|
|
|
|
|
|
/*
|
|
* @implemented
|
|
*/
|
|
void __cdecl srand(unsigned seed)
|
|
{
|
|
next = seed;
|
|
}
|