MATLAB Answers

RandStream generators & dieharder validation suite?

9 views (last 30 days)
Brad Stiritz
Brad Stiritz on 13 Jan 2013
Has anyone investigated the various MATLAB RandStream generator algorithms (see table in middle of page) using the dieharder validation suite? I'm seeking to generate large numbers (in the millions) of exceptionally uniformly random values & would appreciate seeing the detailed tabular output that dieharder provides.
I'm not super-handy with Visual Studio, but can pull off the basics. I would like to build the dieharder project myself, but as far as I can tell it seems to be targeted towards linux. Is this correct? Has anyone successfully modified the project for Visual Studio? If so, do you have general results you could share please about how any of the MATLAB random number generators fare?
I understand that my question relates in large part to a 3rd party product (Visual Studio) & thus isn't eligible for help from MATLAB support. Additionally, perhaps only a small fraction of MATLAB users are experienced with linux, Windows, & Visual Studio.
Obviously, there are other external venues where I can pose this same question. However, given the extensive MATLAB support for random number generation & numerous discussion threads about RNG, I thought I'd give my question a shot here first, hoping to find an interested & expert cross-platform compiler user.
Knowing that offering something especially real in return for help often gets faster results, I'm up for negotiating (via private message) a fair Paypal fee if s/o can provide step-by-step instructions for how to get the latest dieharder distribution to build in VS 2010. Of course, freely-offered help is always appreciated, but not expected in this case.
Due to the complexity of the issue & potential for a confusing thread, I would like to ask please that you make sure to verify a successful build at your end before posting any super-lengthy Answers.
However I get this answered, either here or via some external site, & whether by a helpful altruist or a needy graduate student, I will make sure all relevant information is posted here: a complete step-by-step solution & my test results for 2-3 chosen RandStream generators.
Thanks, Brad
Jan on 14 Jan 2013
Dear Brad, without doubt you were very clear about your intention to share the results. You have neither been offending not rude. Offering a fee is polite, legal and fair. I do not not want to discourage you to pay anybody who assists you to solve your problem. Therefore I have no reasons to criticize the contents or tone of your question.
I got too many personal messages of cheaters, who offered some dollars for solving their homework. In opposite to this your question has a obviously a serious background. But the public appearance of money can have a bad influence to a forum, which lives from voluntary contributors. Therefore I've written, that I personally do not want this to happen more often, but not, that it should not happen at all.
In another Matlab forum there is a specific category for payed programming or assistance jobs. Unfortunately in this category about 20% of the threads must be deleted, because they violate the forum policies.
I hope my opinion got clearer now.

Sign in to comment.

Accepted Answer

Jan on 13 Jan 2013
Edited: Jan on 13 Jan 2013
Asking your favorite search engine would reveal some useful instructions in the net, e.g.:
Reading the instructions in the 2nd link are important: While compiling and running DIEHARDER is more or less easy, interpreting the results is very hard science. As long as all pseudo-random-number-generators are deterministic, tests like DIEHARD and DIEHARDER can check the entropy level only.
If you need good random numbers, true random numbers are strongly recommended:
The underlying service at is limited, see quota. Therefore getting "millions" of numbers might be either take some time (days!), or you must pay for it. Another idea is to inflate the true random numbers by using them as frequently changing seeds for your pseudo-RNG. But in this case, testing the results by DIEHARDER is a good idea again.
Creating a true-RNG hardware at home is not very hard: One idea was to let an USB camera record a lava lamp and build differences between subsequent images to obtain random bits caused by noise. In a further step you can even omit the lava lamp and use a camera which create more noisy output for darker images and stick a black sheet of paper in front of the lens. Much more detailed instructions can be found by an internet research again.
Brad Stiritz
Brad Stiritz on 22 Jan 2013
After lengthy & convincing discussion with Jan (see comments below), I realized that he's right: porting the dieharder project to MSVC would be a very poor use of time, especially given the limited & occasional dieharder use I imagine for myself.
Jan's Answer is to learn the basics of Ubuntu Linux & then run the dieharder binary directly.
I will create test data in Windows & copy to a USB flash drive for access under Ubuntu.

Sign in to comment.

More Answers (2)

Peter Perkins
Peter Perkins on 14 Jan 2013
Brad, if your goal is to run Dieharder, I can't help.
If your goal is to verify that the generators in MATLAB pass stringent tests of randomness, then you'll find that L'Ecuyer and Simard published a paper a few years back that includes results for their TestU01 suite on a wide variety of generators, including mt19937ar, mrg32k3a, and mlfg6331, the recommended current generators in MATLAB.
Hope this helps.
Brad Stiritz
Brad Stiritz on 15 Jan 2013
I forgot to ask: would you mind please editing your original Answer or submitting a new one, with your rationale that a better idea is to run the dieharder distribution as-is under Ubuntu..? This way, readers can see straightaway what the discussion conclusion was. Alternatively, or in addition, do you think I should add an "Update" section to my Question, briefly summarizing our discussion?
Thanks, Brad

Sign in to comment.

Jan Pospisil
Jan Pospisil on 25 Feb 2013
One of my student tested the generators in his bachelor thesis, he used the generators in Matlab as well as the true random generator /dev/urandom in linux systems, then he exported the numbers for dieharder and run all the dieharder tests. If you are interested, I can send you the PDF.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!