Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Randomly permute a given set of numbers
Date: Sun, 12 Sep 2010 07:05:06 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <i6hu32$cb$1@fred.mathworks.com>
References: <i6hq95$fjn$1@fred.mathworks.com> <i6hsgb$3oh$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1284275106 395 172.30.248.38 (12 Sep 2010 07:05:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 12 Sep 2010 07:05:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2493299
Xref: news.mathworks.com comp.soft-sys.matlab:669363

Sorry, my mistake. The _no. of integers_ generated must be in the range 2 to m. 

The condition is that each row must contain _at least_ two non-zero integer values.
Therefore, each row should have 'a' zeros ('a' ranges from 0 to m-2) and 'b' integers ('b' ranges from 2 to m). The values of the integers are 1,2,...,m - a.

For example, take the first row(m=6). It has two zeros (a=2) and b = m - 2 = 4. Therefore, the values of integers = 1,2,3,4.

Also, is there any command to randomly arrange a given set of random numbers, say {13,4,5,6,2} ?


"Matt Fig" <spamanon@yahoo.com> wrote in message <i6hsgb$3oh$1@fred.mathworks.com>...
> "Venkatesh " <svthegreat@gmail.com> wrote in message <i6hq95$fjn$1@fred.mathworks.com>...
> > I have a question wherein I am required to generate integers between 2 and m randomly, without repetition (in an n x m matrix). Therefore, total number of integers generated in a row must be m, with at least two non-zero values. Any way to do this?
> > 
> > The matrix should look somewhat like this (randomly generated):
> > 
> >      0     0     4     1     2     3
> >      3     1     2     0     0     0
> >      0     2     3     0     4     1
> >      0     0     1     0     0     2
> >      3     0     0     1     0     2
> 
> Why do you say "between 2 and m" when you have a 1 and 0 in each row?  What, _exactly_ are the rules?