# pouët.net

Go to bottom

## PRNG's

category: code [glöplog]
The dithering happen because the position is always updated by moving left or right but also up or down:
Code:``` int rnd = seed; for(int j=0; j<8192; j++) { // 8192*16 string lenght rnd += rnd<<16 | rnd>>16; int d = rnd; for(int i=0; i<16; i++) { // plot 16 pixels xp += (d&2)-1; yp += (d&1)*2 -1; d >>= 2; plot(xp, yp); } } ```

Here is another image I call "the genie" using plot(xp/2, yp/2)

added on the 2011-09-03 18:04:42 by T21
Going down memory lane:

ACC = (ACC*3 + TopRightPixel - 0x1E) / 4 + rnd()&0xF + round;

This generate really cheap perlin noise.
rnd() is again : rnd += rnd<<16 | rnd>>16;

added on the 2011-09-03 19:41:36 by T21
so your period is 2^32?
im having period of 2^16. but im using "independent" 8-bit registers in my calcs.
you're saving those images with crappy jpeg compression, jsyk. :P
added on the 2011-09-03 19:58:09 by rudi
Actually this is the random function I used in those test: So 2^64 ?
Code:``` __inline __m128i Rnd() { // 8bytes rnd = _mm_add_epi64(rnd, _mm_shuffle_epi32(rnd, 0x1E)); return rnd; } ```

The fact that I use pure blue doesn't help ms paint default jpeg compression :)
A version shaded with : b = acc; g = acc *acc; r = acc*acc;
added on the 2011-09-03 20:26:39 by T21
Quote:

it's a sailboat!
added on the 2011-09-04 22:13:35 by appas
simple glsl oneliner:
Quote:

float rand(vec2 co){
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}

Also, Perlin and Simplex noise for GLSL.
added on the 2011-09-04 22:16:43 by appas
This is what I saw in the randomness:
Now, lets see your sailboat :)

added on the 2011-09-05 05:09:57 by T21
That looks like a bust.
added on the 2011-09-05 05:27:15 by xernobyl
When I generated those random string I posted the result and called it "the genie" because I kind of saw a face in what looked like smoke rising from the bottom left corner.
The 'bust' is from erasing the 'smoke' around the face to make it obvious.
Here is the original random data with the face colorized blue.

But most seed result in a Scandinavian like coastline:)

added on the 2011-09-05 05:47:50 by T21
Quote:
it's a sailboat!

Quote:
You know what? There is NO Easter Bunny! Over there, that's just a guy in a suit!
added on the 2011-09-05 09:30:37 by gloom
I am le very interested, the random value I am currently using into my shaders doesn't satisfy me :(
added on the 2011-09-05 10:26:04 by rez
T21: The first moment I saw the picture I was sure I was looking at a noise-disfigured portrait of Hitler.
added on the 2011-09-05 11:32:21 by decipher
added on the 2011-09-05 11:49:05 by raer

Go to top