in reply to Re^7: Algorithm RFC: fast (pseudo-)random shuffle with no repetition
in thread Algorithm RFC: fast (pseudo-)random shuffle with no repetition
> I count 7! = 5,040 solutions.
Of course you are right, what my my brain saw was that there is only one possible way to position the 1s.°
What I should better have shown is
(1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2)
which has only one solution
(1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)
and 15! divided by 7! is still a very big number.
> I don't see mention in Algorithm::Permute of how it handles duplicate elements,
Assuming worst case means it's not handling duplicates differently. Many hear just use shuffle which certainly doesn't care.
Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery
°) off by one permutation group ;)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^9: Algorithm RFC: fast (pseudo-)random shuffle with no repetition
by karlgoethebier (Abbot) on Sep 24, 2023 at 18:45 UTC | |
by LanX (Saint) on Sep 24, 2023 at 19:09 UTC | |
by karlgoethebier (Abbot) on Sep 24, 2023 at 20:26 UTC |