| View previous topic :: View next topic |
| Author |
Message |
JJPeerless
Joined: 20 Jun 2005 Posts: 82
|
Posted: Wed Jun 22, 2005 5:56 am Post subject: random number? |
|
|
| how can i generate a random number between some min and max value for the PSP.. |
|
| Back to top |
|
 |
Lain_OTN
Joined: 01 Mar 2005 Posts: 17
|
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Wed Jun 22, 2005 7:37 am Post subject: |
|
|
Google for mersenne twister. It is a very good psuedo random number generator that gives both better random numbers than most other software generators and is faster than virtually all even half decent software based pseudo random number generators.
Just use time, user input, or a combination of the two to seed it. (i.e. grab a seed from the clock and then turn out thousands of random numbers while waiting for user input at the menu) _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Wed Jun 22, 2005 7:45 am Post subject: |
|
|
Funny you mention the mersenne twister, as it's part of the UtilsForUser library in utils.prx:
| Code: | <FUNCTION>
<NID>0xE860E75E</NID>
<NAME>sceKernelUtilsMt19937Init</NAME>
</FUNCTION>
<FUNCTION>
<NID>0x06FB8A63</NID>
<NAME>sceKernelUtilsMt19937UInt</NAME>
</FUNCTION>
|
|
|
| Back to top |
|
 |
Vampire
Joined: 12 Apr 2005 Posts: 138
|
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Wed Jun 22, 2005 9:53 am Post subject: |
|
|
A note about that thread - the MT functions I referred to do not require a seperate PRX from UMD - they are already loaded in RAM when your program runs.
My guess is that Ridge Racers had a seperate MT module for speed. Or something. |
|
| Back to top |
|
 |
th0mas
Joined: 24 Apr 2005 Posts: 43 Location: Canada
|
Posted: Wed Jun 22, 2005 11:49 pm Post subject: |
|
|
This is a little OT for PSP dev, but related to something I'm working on. Hopefully it survives the lockhammer..
Let's say I have 6 unique arbitrary 32-bit integers.
Does anyone know of a method that one could concoct a function that appears to be a pseudo-random number generator that, given the first of the 6 integers as seed, output the second integer. Given the second integer as seed, it would return the third, and so forth. After the 6 values the numbers could actually be pseudo-prime, it doesn't matter. I've taken number theory and never ran into this (or at least, slept through it), nor could I find anything on google.
Any directions you could point me in? _________________ http://th0mas.xbox-scene.com |
|
| Back to top |
|
 |
|