Path: news.mathworks.com!not-for-mail
From: "Steven_Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: gamma random function
Date: Fri, 17 Sep 2010 10:12:50 -0400
Organization: MathWorks
Lines: 31
Message-ID: <i6vt12$pdi$1@fred.mathworks.com>
References: <i6tr60$bqp$1@fred.mathworks.com> <i6ugu4$lup$1@fred.mathworks.com> <i6veel$bli$1@fred.mathworks.com>
NNTP-Posting-Host: ah-slord0w.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain;
	format=flowed;
	charset="UTF-8";
	reply-type=response
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1284732770 26034 172.31.44.22 (17 Sep 2010 14:12:50 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 17 Sep 2010 14:12:50 +0000 (UTC)
In-Reply-To: <i6veel$bli$1@fred.mathworks.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:670902



"Rogelio " <rogelioa@math.uio.no> wrote in message 
news:i6veel$bli$1@fred.mathworks.com...
>>   Presumably all you need to do is set some fixed seed you have chosen 
>> for either rand or else randn (I don't know which) just prior to 
>> generating the sequence of gammarnd quantities to make them repeat the 
>> same sequence of values.  Of course that presupposes that other differing 
>> uses of rand or randn do not intervene during such a generation sequence.
>>
>> Roger Stafford
>
> Thats right. This will give you the same set of numbers each time.
> seed=15;
> randn('state',seed)
> rand('state',seed)
> randg(4,3,1)
> Just two things, you need to set randn and rand everytime before using 
> randg. And gamrnd calls randg, so this also apply to gamrnd.

But the syntax you posted does a bit more than you think it does.

http://www.mathworks.com/help/techdoc/math/bsn94u0-1.html

-- 
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com