Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: randperm
Date: Sun, 27 Jul 2008 15:48:02 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 19
Message-ID: <g6i5bi$bnr$1@fred.mathworks.com>
References: <g6fu97$7ru$1@fred.mathworks.com> <g6g0ia$vp$1@fred.mathworks.com> <g6g1m3$cec$1@fred.mathworks.com> <g6hdm9$j18$1@fred.mathworks.com> <g6hqc7$gck$1@fred.mathworks.com> <g6hr97$sq6$1@fred.mathworks.com> <g6huta$4pa$1@fred.mathworks.com> <g6i0jm$kqb$1@fred.mathworks.com> <g6i287$82n$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1217173682 12027 172.30.248.38 (27 Jul 2008 15:48:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 27 Jul 2008 15:48:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:482077



"ching l" <chinglnc@hotmail.com> wrote in message
<g6i287$82n$1@fred.mathworks.com>...

> 
> I'm thinking of a way of to save the randperm(n) into a
> column matrix and use it one by one controled by the
> program. Then use a counter(a variable) to count which
> random number is using. Then regenerate after the counter =
> n and reset the counter.
> 
> Is this way make sense?
> 

Yes it makes more sense. You can even put the counter inside
a wrapper function using PERSISTENT variable and let it roll
automatically. But don't disperse. Try with your idea first,
I think it's good.

Bruno