Is this random in anyway? It seemed to change pattern over time..
int LastNum = 0, Seed;
...CODE...
char Random() {
int ret;
ret = (LastNum + Seed) % 256;
LastNum = ret;
return ret;
}
//And to init it:
Seed = //some random num goes here
//To use it:
TheChar = Random();
I am switching the cpu to 156MHz, if your gp32 can not handle this speed, it will crashwhen i try to run the FXE on my gp32 all i get is a white screen but if i run it on geepee 32 it runs fine
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;
}