"be consistent" | |
PerlMonks |
Re: list of four digit lock combinations without repeated digitsby johngg (Canon) |
on Jun 22, 2018 at 16:22 UTC ( [id://1217223]=note: print w/replies, xml ) | Need Help?? |
Here are a couple of nested loop solutions that are probably what the *::Combinatorics modules do under the hood.
Done just for fun, the modules are probably the best way to go. Update: Ignore the map version as it is giving incorrect results, right number but wrong digits. Update 2: Spotted my error in the map version, I was initialising the three inner variables too early. This works:-
Cheers, JohnGG
In Section
Seekers of Perl Wisdom
|
|