Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: randn algorithm

Subject: randn algorithm

From: Joachim

Date: 12 May, 2008 20:03:03

Message: 1 of 4

Hi,

I currently convert a Matlab simulation code to Fortran and
need to generate normally distributed random numbers in the
process. Unfortunately, the random numbers provided by the
generators I have at my disposal in Fortran seem to have
slightly different properties than the ones generated by
Matlab's "randn"

The question is, which generate in Intel MKL would provide
random numbers most similar to those provided by randn
(which, I take from "doc randn", uses the ziggurat algorithm)?

I am currently using VSL_BRNG_MCG31 as the base generator
and BOXMULLER as the distribution generator. There are a
bunch of different possibilities as for both the base and
the distribution generator, so I am clueless here.

It would be most useful to know if Matlab uses some external
library (and which one) in generating normal random numbers.

Thanks!

Subject: Re: randn algorithm

From: Joachim

Date: 12 May, 2008 20:21:03

Message: 2 of 4

I shall qualify the question:

- does randn use the same base generator as rand (i.e.,
Mersenne Twister in 7.4)?
- what would be a good newsgroup to ask what differences to
expect between using the Box-Muller transform as opposed to
ziggurat?

Subject: Re: randn algorithm

From: James Tursa

Date: 13 May, 2008 08:30:22

Message: 3 of 4

"Joachim " <a@b.com> wrote in message
<g0a8rf$obt$1@fred.mathworks.com>...
> I shall qualify the question:
>
> - does randn use the same base generator as rand (i.e.,
> Mersenne Twister in 7.4)?
> - what would be a good newsgroup to ask what differences to
> expect between using the Box-Muller transform as opposed to
> ziggurat?

You might try:

sci.math.num-analysis

James Tursa

Subject: Re: randn algorithm

From: Peter Perkins

Date: 13 May, 2008 15:35:10

Message: 4 of 4

Joachim wrote:
> I shall qualify the question:
>
> - does randn use the same base generator as rand (i.e.,
> Mersenne Twister in 7.4)?

No, it uses something that is simpler, and in this context faster, It's related
to but not the same as the one that Marsaglia's original paper described -- it
has a longer period, for one thing.


> - what would be a good newsgroup to ask what differences to
> expect between using the Box-Muller transform as opposed to
> ziggurat?

sci.stat.math perhaps? Statistically, I don't think you need to worry about the
differences between those two transformation methods. The uniform generator
that you use underneath them is probably more important.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
randn Joachim 12 May, 2008 16:05:08
pseudorandom number generator Joachim 12 May, 2008 16:05:08
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics