Mathematics under pseudo random number functions

K.I.L.E.R

Retarded moron
Veteran
I want the knowledge on making my own pseudo random number functions.

I don't care how much the book costs, is there a book I can get on it?
My simulation class isn't running this year(thanks to the idiots who prefer to do shitty subjects like multimedia) or are too scared of maths.

I want the knowledge of PRN functions anyway.
Thanks.
 
I want the knowledge on making my own pseudo random number functions.

I don't care how much the book costs, is there a book I can get on it?
My simulation class isn't running this year(thanks to the idiots who prefer to do shitty subjects like multimedia) or are too scared of maths.

I want the knowledge of PRN functions anyway.
Thanks.

Good pseudo-random number generators are hard to make. Can I suggest you just go and grab, say, the free Mersenne-Twister (e.g. code here) and use that?
 
My personal favorite mainly because it's so deceptively simple and can be done really really fast is a basic vector shuffle and add.
For example, an MMX version might look something like --
Code:
pshufw mm1, mm0, 0x1E
paddd mm0, mm1
mm0 holds the actual numbers and you can read it back however you want. Other shuffles work all right, too. 0x1E simply performs the shuffle such that mm0 as 16-bit chunks A : B : C : D becomes D : C : A : B. You can even feed it a very simple seed value like starting off with mm0 = 0:0:0:1, and while it won't look all that random early on, you give it a few iterations and it will be just fine. And you can do the same thing with floats and floating point vector ops.

Of course, that alone doesn't help you with keeping things in a fixed range, but then that's a problem with any P/Q-RNG.
 
The one I've used for encryption before is a 512 bit shift register implemented via 16 32 bit registers that you rotate and xor with each other in various ways. Use one of the registers as your PRNG output.
 
Back
Top