From: "Steven_Lord" <>
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$>
References: <i6tr60$bqp$> <i6ugu4$lup$> <i6veel$bli$>
Mime-Version: 1.0
Content-Type: text/plain;
Content-Transfer-Encoding: 7bit
X-Trace: 1284732770 26034 (17 Sep 2010 14:12:50 GMT)
NNTP-Posting-Date: Fri, 17 Sep 2010 14:12:50 +0000 (UTC)
In-Reply-To: <i6veel$bli$>
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: comp.soft-sys.matlab:670902

"Rogelio " <> wrote in message 
>>   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.

Steve Lord
comp.soft-sys.matlab (CSSM) FAQ:
To contact Technical Support use the Contact Us link on