hi Miller and others,
as I have resumed cyclone hacking today (after a long break), I would like to finish coding the 'random' family first.
Not being even close to an expert on random number generators, I have borrowed the two used in the 'random' and 'noise~' builtins. Today, just in order to have a quick try, I have used them to produce an input for the 'diehard' set of tests. Now I have three questions:
1. Before I start learning how to correctly interpret all the results -- have been such, or similar, or any kind of tests, performed for the Pd rngs?
2. Seeing that the one used in noise~ (d_osc.c) has suboptimal period length (2^{30}), I wonder if this does matter for the `whiteness' of the output, or does not? (The multiplier a = 435898247 fails the property of b = a - 1 being a multiple of 4 -- this is in Knuth 3.2.1.2, at least in a Polish translation:)
3. Waiting for a return of our mac used for checking things in max/msp, I am not able yet to check what kind of output max/msp rng produces. Any hint?
thanks, Krzysztof
Hi Krzysztof,
I've never carefully tested the RNG in Pd, just typed out two huge numbers with my eyes closed, and never read that part of Knuth... If there's a good, simple cross-platform random number generator I'd be happy to use it, but I wouldn't trust anything native to Windows. Finally I could find no better solution than to write my own, bad one. I did listen to noise~ output (sounded OK), looked at its spectrum (looks mighty flat) and did a histogram on a "random 10" (got 10 roughly equal numbers).
I think I did the same thing in the original Max but by now it might be replaced with something better, I dunno...
cheers Miller
On Tue, Aug 27, 2002 at 04:33:11PM +0200, Krzysztof Czaja wrote:
hi Miller and others,
as I have resumed cyclone hacking today (after a long break), I would like to finish coding the 'random' family first.
Not being even close to an expert on random number generators, I have borrowed the two used in the 'random' and 'noise~' builtins. Today, just in order to have a quick try, I have used them to produce an input for the 'diehard' set of tests. Now I have three questions:
- Before I start learning how to correctly interpret all the
results -- have been such, or similar, or any kind of tests, performed for the Pd rngs?
- Seeing that the one used in noise~ (d_osc.c) has suboptimal
period length (2^{30}), I wonder if this does matter for the `whiteness' of the output, or does not? (The multiplier a = 435898247 fails the property of b = a - 1 being a multiple of 4 -- this is in Knuth 3.2.1.2, at least in a Polish translation:)
- Waiting for a return of our mac used for checking things in
max/msp, I am not able yet to check what kind of output max/msp rng produces. Any hint?
thanks, Krzysztof
PD-dev mailing list PD-dev@iem.kug.ac.at http://iem.kug.ac.at/cgi-bin/mailman/listinfo/pd-dev
I recommend the following BSD lisenced algorithm. It's fast and simple (does not require mod or divide) and it's got a period of 2^19937: http://www-personal.engin.umich.edu/~wagnerr/MersenneTwister.html Unfortunately the original homepage with the c source is down at the moment, but i have the code lying around in my dev directory somewhere. The link above has C++ code only. I implemented this on the gameboy advance and found it's randomness quite (qualitatively speaking) satisfactory.
The only restriction as far as i know is that the original inventors are credited.
Regards,
Chris.
On Tue, 27 Aug 2002 08:59:59 -0700 Miller Puckette mpuckett@man104-1.ucsd.edu wrote:
Hi Krzysztof,
I've never carefully tested the RNG in Pd, just typed out two huge numbers with my eyes closed, and never read that part of Knuth... If there's a good, simple cross-platform random number generator I'd be happy to use it, but I wouldn't trust anything native to Windows. Finally I could find no better solution than to write my own, bad one. I did listen to noise~ output (sounded OK), looked at its spectrum (looks mighty flat) and did a histogram on a "random 10" (got 10 roughly equal numbers).
I think I did the same thing in the original Max but by now it might be replaced with something better, I dunno...
cheers Miller
On Tue, Aug 27, 2002 at 04:33:11PM +0200, Krzysztof Czaja wrote:
hi Miller and others,
as I have resumed cyclone hacking today (after a long break), I would like to finish coding the 'random' family first.
Not being even close to an expert on random number generators, I have borrowed the two used in the 'random' and 'noise~' builtins. Today, just in order to have a quick try, I have used them to produce an input for the 'diehard' set of tests. Now I have three questions:
- Before I start learning how to correctly interpret all the
results -- have been such, or similar, or any kind of tests, performed for the Pd rngs?
- Seeing that the one used in noise~ (d_osc.c) has suboptimal
period length (2^{30}), I wonder if this does matter for the `whiteness' of the output, or does not? (The multiplier a = 435898247 fails the property of b = a - 1 being a multiple of 4 -- this is in Knuth 3.2.1.2, at least in a Polish translation:)
- Waiting for a return of our mac used for checking things in
max/msp, I am not able yet to check what kind of output max/msp rng produces. Any hint?
thanks, Krzysztof
PD-dev mailing list PD-dev@iem.kug.ac.at http://iem.kug.ac.at/cgi-bin/mailman/listinfo/pd-dev
PD-dev mailing list PD-dev@iem.kug.ac.at http://iem.kug.ac.at/cgi-bin/mailman/listinfo/pd-dev
hi Chris,
thanks for the pointer. I have briefly looked at MT19937 some time ago, and thought it would be worth a try. Now I am looking at an original implementation (claimed to be slower than an improved version you are referring to, by a factor of 1.7), and starting to have some doubts.
1. I do not know if MT199937 is well suited for inlining in a 'perform' routine of a tilde object. Correct me, if I am wrong.
2. Control classes might pay a small extra price in speed of course. But how big it really is? My lame measurements show the original MT19937 to be approx 20 times slower than quick'n'dirty LCG. Again, I may be wrong.
3. There would also be some memory overhead (approx 2.5kB for every object).
4. MT19937 is GPLed.
Krzysztof
Chris McCormick wrote:
I recommend the following BSD lisenced algorithm. It's fast and simple (does not
require mod or divide) and it's got a period of 2^19937: