Path: news.mathworks.com!not-for-mail
From: "ching l" <chinglnc@hotmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: randperm
Date: Sat, 26 Jul 2008 20:33:07 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 37
Message-ID: <g6g1m3$cec$1@fred.mathworks.com>
References: <g6fu97$7ru$1@fred.mathworks.com> <g6g0ia$vp$1@fred.mathworks.com>
Reply-To: "ching l" <chinglnc@hotmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1217104387 12748 172.30.248.35 (26 Jul 2008 20:33:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 26 Jul 2008 20:33:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1438759
Xref: news.mathworks.com comp.soft-sys.matlab:481989



"matt dash" <n.a@mail.com> wrote in message
<g6g0ia$vp$1@fred.mathworks.com>...
> "ching l" <chinglnc@hotmail.com> wrote in message
> <g6fu97$7ru$1@fred.mathworks.com>...
> > a= randperm(6)
> > 
> > I want the "a" to have different number each time, between 
> > 1 to 6.  However, by using randperm, it called out all the 6
> > random numbers at a time, which become a= 1 4 6 2 3 5
> > 
> > How do I have different random "a" each time?
> > 
> > for example, 
> > 
> > a= 1
> > 
> > a= 3
> > 
> > a= 5
> > 
> > instead of a= 1 4 2 6 3 5
> > 
> > 
> > 
> 
> 
> 
> a=ceil(6*rand)

but it's going to repeat some time....

I don't want it to repeat, I want to have random number from
1 to 6, for six time, and no repeat number.

is that possible?