Here's some code swiped from POVRAY 2.2 source ibm.c:
Code:
static unsigned long int next = 1;
int
m_rand(void)
{
next = next * 1103515245L + 12345L;
return ((int) (next / 0x10000L) & 0x7FFF);
}
void
m_srand(int seed)
{
next = (unsigned long int)seed;
}
If you don't have the luxury of GpTickCountGet for seeding, I suggest setting up a simple main loop counter.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.