17
Inspired by this badly received migrated post.
The head of security at your company is concerned about your PIN generating system after it gave him 12345
. He also didn't really appreciate the Spaceballs joke you made at his expense, so you've been delegated to re-write the PIN generator. Since it has to fit on some special hardware, you have to make it as small as possible.
Your Task
- You take two inputs - # of PINs, and PIN size in digits.
- Generate the specified number of PINs of the specified size randomly and print it out.
- All valid PIN's of the size must be possible to be printed out, even if they aren't uniformly probable.
However, there are some restrictions on the PINs - here are the invalid ones:
- If all the pairs are the same digit:
114422
(Note: this will obviously include all same digit PINs). - Increasingly linear PINs (mod 10):
246802
. - All groups of 3 are physical lines on the keypad of
1 2 3;4 5 6;7 8 9;bksp 0 enter;
:147369
. - The PIN can be entirely split up into groups from rule 1 and rule 3.
- If all the pairs are the same digit:
- This is code-golf, so shortest code in bytes wins!
Does rule one also include a single double pair (like
55123
)? – mınxomaτ – 2015-10-12T18:40:18.113@minxomat good point, ammending the rules to include both groups. That one will since the second half is
123
, but55432
would be fine. – Maltysen – 2015-10-12T18:42:36.407Does rule 3 include diagonals? – Martin Ender – 2015-10-12T20:57:25.470
6The irony is that this definition of a so called "secure" pin only reduces the number of pins attackers might have to brute force! – DankMemes – 2015-10-13T01:36:59.007
@MartinBüttner no. – Maltysen – 2015-10-13T01:52:19.580
1What's the shortest length for rule 2? – Dennis – 2015-10-13T03:44:00.637