From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Derangement: efficient full permutation
Date: Tue, 1 Feb 2011 13:09:04 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 7
Message-ID: <ii90lg$qmd$>
References: <ii8ut8$3fb$>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1296565744 27341 (1 Feb 2011 13:09:04 GMT)
NNTP-Posting-Date: Tue, 1 Feb 2011 13:09:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: comp.soft-sys.matlab:707416

> BUT: All who had participated in the former discussion (Jos, Derek, me, ...) had suggested algorithm with bugs. Therefore I hope, that somebody can confirm, that this method creates all derangements without a bias - or point me to the errors, before I publish the mexed version in the FEX.

Your algorithm surely has BUG, e.g., n = 1 it generate a derangement 1, which is impossible.