Path: news.mathworks.com!not-for-mail
From: "Derek O'Connor" <derekroconnor@eircom.net>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Randperm, Randi, and Shuffle
Date: Mon, 13 Dec 2010 01:10:28 +0000 (UTC)
Organization: University College Dublin
Lines: 29
Message-ID: <ie3rq4$s92$1@fred.mathworks.com>
References: <iaq1os$sak$1@fred.mathworks.com> <idpcig$7a8$1@fred.mathworks.com> <idqqm6$rdv$1@fred.mathworks.com> <idr6uj$n9r$1@fred.mathworks.com> <idti1v$55l$1@fred.mathworks.com>
Reply-To: "Derek O'Connor" <derekroconnor@eircom.net>
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 1292202628 28962 172.30.248.37 (13 Dec 2010 01:10:28 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 13 Dec 2010 01:10:28 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 87230
Xref: news.mathworks.com comp.soft-sys.matlab:694863

"Jos (10584) " <#10584@fileexchange.com> wrote in message <idti1v$55l$1@fred.mathworks.com>...
> "Derek O'Connor" <derekroconnor@eircom.net> wrote in message <idr6uj$n9r$1@fred.mathworks.com>...
> > "Jos (10584) " <#10584@fileexchange.com> wrote in message <idqqm6$rdv$1@fred.mathworks.com>...
> > > 
> > > You might also like to take a look at (the code) of RANDPERMFULL
> > > http://www.mathworks.com/matlabcentral/fileexchange/23257-randpermfull
> > > 
> > > Jos
> > 
> > Dear Jos,
> > 
> > I ran and profiled both GenPerm and randpermfull with n = 10^7.
> > 
> ...
> 
> Thanks Derek. Your swapping method is indeed more efficient. I decided to modify the code of RANDPERMFULL, the new version should be up in a few days.
> 
> Jos

Jos,
The profiler can add a lot to the run times so I ran GenPerm and randfullperm 
without  the profiler to see the actual performance:

GenPerm(10^7) = 2 secs ,  GenPerm(10^8) = 24 secs

randfullperm(10^7) = 20 secs ,    randfullperm(10^8) = 211 secs


Derek O'Connor