Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: recovering the jth state of the random number generator
Date: Fri, 5 Sep 2008 23:57:01 +0000 (UTC)
Organization: Johns Hopkins School of Med
Lines: 26
Message-ID: <g9sh0d$pra$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1220659021 26474 172.30.248.37 (5 Sep 2008 23:57:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 5 Sep 2008 23:57:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1442513
Xref: news.mathworks.com comp.soft-sys.matlab:488874



Hi,

i am trying to produce a stimulus sequence using the following procedure:

 rand ('state', 0)

for i = 1:90000
    randomnoisematrix = rand (45,45)
end


Once this stimulus is presented, i have to reverse correlate the response to various epochs of the stimulus.  Say, to the states of the stimulus between the 43000 and 43060 iterations.

I find that if i run the iteration above repeatedly, to any given point ( say 43001) i get back the same randomnoise matrix as expected, however if i   ask for 
rand ('state', 43001)
randmonoisematrix = rand (45, 45) i get a completely different output.  
I other words, it appears that the state 0 is not followed by the state 1, 2, 3 etc.
Does anybody know what is going on ?  

The reason i want to do this is because i do not want to have to run each time through the whole sequence to get to my epoch of interest, but rather would like to "skip" ahead to the state i want (inbetween 43000 and 43060 for example).

Thanks a lot.

Tudor