How it works
1. RandomnessThe browser takes 128–256 bits from the system source of random numbers — the same one used for encryption keys. An ordinary random-number generator will not do here: it is predictable.
2. ChecksumSHA-256 is taken of those bits, and the first few bits of the result are appended: one bit for every 32 bits of randomness. For 12 words that is 4 bits, for 24 it is eight.
3. WordsThe resulting chain is cut into 11-bit pieces. Each piece is a number from 0 to 2047 — the index of a word in the standard list. That is where both the size of the list and the multiple-of-three word count come from.
4. VerificationThe reverse: words turn into indices, indices into bits, SHA-256 is recomputed from the start and compared with the tail. No match means a typo somewhere, or a word out of order.