PRNG's
category: code [glöplog]
quote Wikipedia: "If a PRNG's internal state contains n bits, its period can be no longer than 2^n results."
Internal state, what does that mean?
If I use two 8-bit registers in calculation this period 2^16 should be true, because two 8-bit registers equals 16-bits in total, even if they only perform 8-bit arithmetic...
Internal state, what does that mean?
If I use two 8-bit registers in calculation this period 2^16 should be true, because two 8-bit registers equals 16-bits in total, even if they only perform 8-bit arithmetic...
yes.
as for intitial condition the best seed is the value zero.
yea las, i was confused at first, but had to think through it.
any ideas for testing. i was thinking of doing the Monte Carlo method, but i heard its not 100% accurate. However I want to start with something easy..
What do you need your PRNG for? What do you want to test exactly?
http://en.wikipedia.org/wiki/Diehard_tests
If you need a very fast, small prng that you can also quickly reset it seeds value while it still passes the diehard tests I can warmly recommend the xor shift randomizer.
i think that is what i am using. i think its a linear congruential generator with xor bit-twiddling i am using.
thanks for the paper anyway! everything i can read about that i understand is usefull.
Probably not needed but you can simplify the xor shift method to an add/shuffle and reduce the code complexity by 5x
based on one's and zero's i made this 1D and 2D random walks. it has 2^16 period and is pretty small in size for generation.
i chopped up the image (its too damn big) you only see the first steps.
1D walk.
![BB Image](http://imgbin.org/images/4940.png)
based on the same prng i made this walk in 2D.
![BB Image](http://imgbin.org/images/4941.png)
2D walk, but this are based on some value from the generator using one of the variables as choosing the bits to compare. show some pretty strange output behaviour.
![BB Image](http://imgbin.org/images/4942.png)
i chopped up the image (its too damn big) you only see the first steps.
1D walk.
![BB Image](http://imgbin.org/images/4940.png)
based on the same prng i made this walk in 2D.
![BB Image](http://imgbin.org/images/4941.png)
2D walk, but this are based on some value from the generator using one of the variables as choosing the bits to compare. show some pretty strange output behaviour.
![BB Image](http://imgbin.org/images/4942.png)
forgot to mention in the first image you see every bit in the 8-bit register. they are based on the one's or zero's. i.e. 0 goes left, 1 goes right on each step or vice versa.
Another way to visualize the bit distribution is filling a bitplane.
BTW, does those result really differ much from doing?
x += x<<8 | x>>8;
BTW, does those result really differ much from doing?
x += x<<8 | x>>8;
T21: not the first and second image. the third image are a bit different when it comes to choosing what direction the particle go.
prng for color shades:
![BB Image](http://imgbin.org/images/4943.png)
for same prng based on bitvalues:
![BB Image](http://imgbin.org/images/4944.png)
![BB Image](http://imgbin.org/images/4943.png)
for same prng based on bitvalues:
![BB Image](http://imgbin.org/images/4944.png)
Just to be clear, I was mentioning
x += x<<8 | x>>8;
as the actual number generator :)
x += x<<8 | x>>8;
as the actual number generator :)
T21: please geive some output of that if you cn
![BB Image](http://img263.imageshack.us/img263/5373/rndm.jpg)
I also used this in the poison & dot ball thread
![BB Image](http://img23.imageshack.us/img23/4134/rnd3.jpg)
2 example of bit plotted
Longer string (262k bit lenght)
![BB Image](http://img846.imageshack.us/img846/2576/rnd4l.jpg)
![BB Image](http://img545.imageshack.us/img545/8716/rnd4b.jpg)
![BB Image](http://img846.imageshack.us/img846/2576/rnd4l.jpg)
![BB Image](http://img545.imageshack.us/img545/8716/rnd4b.jpg)
oh, nice that last one
subject matter and visual stimuli highly applauded, thanks gents
Why does it look so dithered?
Graga: Because it's very likely that the function's codomain is not Lipschitz continuous?