reactos/lib/sdk/crt/math/rand.c
Timo Kreuzer 6afbc8f483 Hopefully create a branch and not destroy the svn repository.
svn path=/branches/reactos-yarotows/; revision=45219
2010-01-23 23:25:04 +00:00

27 lines
463 B
C

/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <precomp.h>
#include <internal/tls.h>
/*
* @implemented
*/
int
rand(void)
{
PTHREADDATA ThreadData = GetThreadData();
ThreadData->tnext = ThreadData->tnext * 0x5deece66dLL + 2531011;
return (int)((ThreadData->tnext >> 16) & RAND_MAX);
}
/*
* @implemented
*/
void
srand(unsigned int seed)
{
PTHREADDATA ThreadData = GetThreadData();
ThreadData->tnext = (ULONGLONG)seed;
}