random number?
-
- Posts: 82
- Joined: Mon Jun 20, 2005 3:32 am
random number?
how can i generate a random number between some min and max value for the PSP..
Google is your friend.
Search for Pseudo Random Generators in C
like: http://astronomy.swin.edu.au/~pbourke/analysis/random/
EDIT: You can also search for rand in the API documentation:
http://pspdev.ofcode.com/api.php?simple ... on1=Search
seems like the ssl library has rand functions, How it works... no idea :p
Search for Pseudo Random Generators in C
like: http://astronomy.swin.edu.au/~pbourke/analysis/random/
EDIT: You can also search for rand in the API documentation:
http://pspdev.ofcode.com/api.php?simple ... on1=Search
seems like the ssl library has rand functions, How it works... no idea :p
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)
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
Makeshift Development
Funny you mention the mersenne twister, as it's part of the UtilsForUser library in utils.prx:
Code: Select all
<FUNCTION>
<NID>0xE860E75E</NID>
<NAME>sceKernelUtilsMt19937Init</NAME>
</FUNCTION>
<FUNCTION>
<NID>0x06FB8A63</NID>
<NAME>sceKernelUtilsMt19937UInt</NAME>
</FUNCTION>
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?
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?