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 06:09:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 12
Message-ID: <i6hqq0$ilg$1@fred.mathworks.com>
References: <i6hq95$fjn$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1284271744 19120 172.30.248.37 (12 Sep 2010 06:09:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 12 Sep 2010 06:09:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2386204
Xref: news.mathworks.com comp.soft-sys.matlab:669356

"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

doc randperm