Logo by bib - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Did you know ? you can use LaTex inside Postings on fractalforums.com!
 
*
Welcome, Guest. Please login or register. April 17, 2024, 01:10:44 AM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: [1]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: 8-bit random (unsigned)  (Read 3707 times)
0 Members and 1 Guest are viewing this topic.
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« on: October 01, 2011, 06:14:59 AM »

Hi all, does anyone know the correct coding for an 8-bit equivalent of the 32 or 64 bit Mersenne Twister pseudo-random algorithm ?

Edit: I mean the correct bits to test/shift etc. to produce a complete sequence that is as statistically random for the number range as the standard 32-bit version is.
« Last Edit: October 02, 2011, 07:14:15 PM by David Makin » Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #1 on: October 04, 2011, 01:30:31 PM »

lol, i just know the 8 bit use of c64 time cia to generate random pattrerns cheesy
Logged

---

divide and conquer - iterate and rule - chaos is No random!
hobold
Fractal Bachius
*
Posts: 573


« Reply #2 on: October 04, 2011, 08:37:30 PM »

May I ask what is limiting you? Is it just a matter of efficiency, so that you don't generate 32 random bits but throw away 24 of those? Or do you actually have to run on 8 bit hardware?

And if it is an 8 bit machine, why do you need to have the very high quality of a Mersenne Twister, when that poor little processor would need maybe hundreds of years to begin repeating the sequence?

Or is it about running lots and lots of independent random number generators in parallel on SIMD (vector ALU, GPU) hardware?

Just curious. Maybe a much simpler random number generator would already be sufficient for your purposes.
Logged
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #3 on: October 05, 2011, 05:34:20 AM »

May I ask what is limiting you? Is it just a matter of efficiency, so that you don't generate 32 random bits but throw away 24 of those? Or do you actually have to run on 8 bit hardware?

And if it is an 8 bit machine, why do you need to have the very high quality of a Mersenne Twister, when that poor little processor would need maybe hundreds of years to begin repeating the sequence?

Or is it about running lots and lots of independent random number generators in parallel on SIMD (vector ALU, GPU) hardware?

Just curious. Maybe a much simpler random number generator would already be sufficient for your purposes.

SIMD - and a "simpler" algorithm simply will *not* do, unless you know one that is both faster and as statistically random *at all sample bit sizes* as the Mersenne - 32 bits *would* do, or indeed 16 or anything 8+.
Exceptionally good statistical randomness is necessary as data produced is used in a tiered manner by xor-ing values together and in that case any bias is greatly magnified.
Come to think of it, it's possible that splitting the 32 bit Mersenne into 4 separate streams of 8 may do just as good a job as a "correct" 8-bit version - I wouldn't know without testing using the brute-force method i.e. suck it and see wink
I was hoping that those more mathematically educated than myself may be able to help.
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
hobold
Fractal Bachius
*
Posts: 573


« Reply #4 on: October 05, 2011, 12:14:50 PM »

I'm told that the Mersenne Twister produces pseudo random sequences of excellent statistical quality (only cryptographically secure generators are significantly better, but also significantly slower). So you should be able to, say, run 32 bit generators in those SIMD lanes and then use the result as four packed bytes.
Logged
ker2x
Fractal Molossus
**
Posts: 795


WWW
« Reply #5 on: October 05, 2011, 03:42:03 PM »

you could probably adapt the xorshift algorithm to 8.
the randomness is not crypto-secure but it's good enough for montecarlo-based fractal stuff.
I use the regular 32bits version in my openCL code.

eg : http://www.arklyffe.com/main/2010/08/29/xorshift-pseudorandom-number-generator/

Code:
// returns values from 1 to 255 inclusive, period is 255
uint8_t xorshift8(void) {
    y8 ^= (y8 << 7);
    y8 ^= (y8 >> 5);
    return y8 ^= (y8 << 3);
}

you can add more register to have a longer period.
Logged

often times... there are other approaches which are kinda crappy until you put them in the context of parallel machines
(en) http://www.blog-gpgpu.com/ , (fr) http://www.keru.org/ ,
Sysadmin & DBA @ http://www.over-blog.com/
David Makin
Global Moderator
Fractal Senior
******
Posts: 2286



Makin' Magic Fractals
WWW
« Reply #6 on: October 06, 2011, 02:53:04 AM »

I'm told that the Mersenne Twister produces pseudo random sequences of excellent statistical quality (only cryptographically secure generators are significantly better, but also significantly slower). So you should be able to, say, run 32 bit generators in those SIMD lanes and then use the result as four packed bytes.

Thanks, that actually makes things pretty straightforward wink
Logged

The meaning and purpose of life is to give life purpose and meaning.

http://www.fractalgallery.co.uk/
"Makin' Magic Music" on Jango
Pages: [1]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Random Mandelbulb 3d « 1 2 » paolo 17 6549 Last post January 17, 2017, 07:39:51 AM
by Mrz00m
Auto Preset Randomiser, random preset combiner 3D Fractal Generation ant123 0 1937 Last post February 05, 2012, 09:36:06 PM
by ant123
Generalized Apollonius: random ellipsoid packings 3D Fractal Generation hobold 3 2049 Last post February 04, 2013, 07:28:29 PM
by knighty
Not all random numbers are equaly random General Discussion Alef 10 3632 Last post October 10, 2013, 11:25:27 PM
by Roquen
Random generator Feature Requests Alexcs 5 1865 Last post April 17, 2017, 10:24:36 AM
by zebastian

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.194 seconds with 24 queries. (Pretty URLs adds 0.008s, 2q)