Path: news.mathworks.com!not-for-mail
From: "Steven_Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: random numbers in parallel
Date: Fri, 26 Apr 2013 13:12:35 -0400
Organization: MathWorks
Lines: 36
Message-ID: <kleci3$dab$1@newscl01ah.mathworks.com>
References: <74bbfeaa-2bc7-4c3d-9b2c-39624a0229bb@googlegroups.com> <klcu5v$2d4$1@newscl01ah.mathworks.com> <28fe2c6f-c9e0-49fb-9514-f59287e53b1b@googlegroups.com>
NNTP-Posting-Host: ah-slord.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain;
	format=flowed;
	charset="iso-8859-1";
	reply-type=original
Content-Transfer-Encoding: 7bit
X-Trace: newscl01ah.mathworks.com 1366996355 13643 172.28.9.169 (26 Apr 2013 17:12:35 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 26 Apr 2013 17:12:35 +0000 (UTC)
In-Reply-To: <28fe2c6f-c9e0-49fb-9514-f59287e53b1b@googlegroups.com>
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Newsreader: Microsoft Windows Live Mail 14.0.8089.726
X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8089.726
Xref: news.mathworks.com comp.soft-sys.matlab:794409



"Gideon" <gideon.simpson@gmail.com> wrote in message 
news:28fe2c6f-c9e0-49fb-9514-f59287e53b1b@googlegroups.com...
> Thanks Patrick.

Peter is the one to whom you responded.

>  It sounds like I am in the "easy" case.  The code I have is of the 
> following form:
>
> data = zeros(N,1);
>
> parfor k = 1:N
>
> xi = randn(M,1);
> data(k) = f(xi);
>
> end
>
> In other words, I want N realizations of a certain function f which 
> depends on having M i.i.d. Gaussian random variables.  So all I want here 
> is to ensure that each worker is getting an independent stream of random 
> numbers when it goes on to use randn.

You might find this section of the documentation interesting and/or 
reassuring.

http://www.mathworks.com/help/distcomp/control-random-number-streams.html

-- 
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com