Random PINs, and the ones a guesser tries first
A 4-digit PIN has 10,000 possible values, 0000 to 9999. That sounds small, and for a password it would be, but a PIN is protected differently. A bank card swallows itself after three wrong tries and a phone slows down or wipes itself after ten. Against a guesser with three tries, a truly random 4-digit PIN gives odds of 3 in 10,000. The trouble is that people do not choose PINs at random, and guessers know it.
In 2012 the data blog DataGenetics studied 3.4 million 4-digit PINs from leaked lists. The single most common, 1234, was about one PIN in nine. The top 20, a list that includes 1111, 0000, 1212, 7777, 2000 and 4321, covered more than a quarter of everyone. Years were common, especially the 1900s, and so were dates written as day and month or month and day. A guesser with three tries starts with those, and their odds are far better than 3 in 10,000.
This page draws each digit with crypto.getRandomValues, the browser's secure random source, so every PIN of the chosen length is equally likely. It then checks the result against the patterns that guessers try first: one digit repeated, a run counting up or down, a repeated block such as 1212 or 123123, one of the top 20 from that study, a year from 1900 to 2029, and a valid day and month in either order. If the PIN matches any of them, the note under it says which and suggests a second draw.
The page never drops such a PIN on its own. That may seem backwards, but a random 1990 is exactly as random as a random 5830. The danger is not in the number; it is that a guesser will try 1990 early. If a generator silently skipped every PIN that looked like a year, the PINs it showed would come from a smaller set, and that smaller set would be a little easier to guess. Telling you, and leaving the choice to you, keeps the draw honest.
Length matters more than anything else. A 6-digit PIN has a million possible values and an 8-digit one a hundred million, so use the longest the device allows. Many phones accept 6 digits or more, and some locks accept up to 12. The Other length option covers anything from 3 to 12 digits.
The PIN is made in this page and is not sent anywhere. Set it, then close the tab. And cover the keypad when you use it: a random PIN protects against guessing, not against someone watching over your shoulder.