Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Improving generated random numbers
#1
Hi,

I'm coding for now a homebrew which involves lots of random events, so I have to generate a lot of pseudo-random numbers. After having read tutorials from some places over the web, the code is:

Code:
int main(void) { SceKernelUtilsMt19937Context ctx; sceKernelUtilsMt19937Init(&ctx, time(NULL)); char UnsecureBuffer[25]; u32 rand_val = (sceKernelUtilsMt19937UInt(&ctx))%201; sprintf(UnsecureBuffer, "Your current IQ is: %d\n", (int)rand_val); printf(UnsecureBuffer); return 0; }

This works on the real hardware, not in PPSSPP, where the generated number is always 0.
Reply


Messages In This Thread
Improving generated random numbers - by 240-185 - 05-19-2013, 10:38 AM

Forum Jump: