[CRT] Move rand to stdlib, where it belongs

This commit is contained in:
Timo Kreuzer 2024-04-11 19:49:42 +03:00
parent d55f49978d
commit 43beb913da
4 changed files with 8 additions and 7 deletions

View file

@ -0,0 +1,29 @@
#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;
}