http://qs321.pair.com?node_id=695798


in reply to Random Derangement Of An Array

http://search.cpan.org/~allenday/Math-Combinatorics-0.09/lib/Math/Combinatorics.pm#derange()?

Replies are listed 'Best First'.
Re^2: Random Derangement Of An Array
by BrowserUk (Pope) on Jul 06, 2008 at 08:25 UTC

    Shame that, according to its own documentation, it doesn't work!

    Usage : my @deranges = derange(@n); Function: implements !n, a derangement of n items in which none of th +e items appear in their originally ordered place. Example : my @n = qw(a b c); my @d = derange(@n); print join "\n", map { join " ", @$_ } @d; # prints: # a c b ### Not a derangment; a in it's original position # b a c ### Not a derangment; c in it's original position # b c a # c a b # c b a ### Not a derangment; b in it's original position

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.