User Rating 0.0
Total Usage 0 times
Presets:
Press Generate or a preset to begin
History 0
Is this tool helpful?

Your feedback helps us improve.

About

Selecting a letter at random appears trivial until bias enters the process. Human attempts at "random" selection skew heavily toward familiar letters (A, E, S) and avoid less common ones (Q, X, Z). This generator uses the Web Crypto API (crypto.getRandomValues) to produce cryptographically secure uniform distribution across all 26 positions. Each letter has an exact probability of 126 3.846% per draw. The tool applies rejection sampling to eliminate modulo bias that plagues naive implementations. Use cases include classroom exercises, game letter draws, password character selection, and statistical sampling experiments.

Limitation: when "unique only" mode is active, the maximum output equals the alphabet size (26 for English). The generator implements Fisher-Yates partial shuffle for this mode, guaranteeing O(k) time complexity where k is the requested count. Pro tip: for board game letter draws (Scrabble, Bananagrams), use unique mode with the count matching tiles needed per turn.

random letter generator alphabet generator random character letter picker random letter

Formulas

Each letter is selected using a cryptographically secure random index. The core selection function produces a uniform random integer in the range [0, n 1] where n is the alphabet size.

index = crypto.getRandomValues(Uint32) mod n

Naive modulo creates bias when 232 is not evenly divisible by n. Rejection sampling eliminates this. The threshold is computed as:

threshold = 232 (232 mod n)

Any random value threshold is discarded, and a new value is drawn. This guarantees each of the n outcomes has exact probability:

P(letter) = 1n

For unique (non-repeating) selection of k letters from n, the Fisher-Yates partial shuffle runs in O(k) time. The number of possible unique sequences is the permutation count:

P(n, k) = n!(n k)!

Where n = alphabet size (e.g., 26 for English), k = number of letters requested, and P = probability of any specific letter appearing in a single draw.

Reference Data

LetterPositionProbability (Single Draw)English FrequencyNATO PhoneticMorse Code
A13.846%8.167%Alpha· −
B23.846%1.492%Bravo− · · ·
C33.846%2.782%Charlie− · − ·
D43.846%4.253%Delta− · ·
E53.846%12.702%Echo·
F63.846%2.228%Foxtrot· · − ·
G73.846%2.015%Golf− − ·
H83.846%6.094%Hotel· · · ·
I93.846%6.966%India· ·
J103.846%0.153%Juliet· − − −
K113.846%0.772%Kilo− · −
L123.846%4.025%Lima· − · ·
M133.846%2.406%Mike− −
N143.846%6.749%November− ·
O153.846%7.507%Oscar− − −
P163.846%1.929%Papa· − − ·
Q173.846%0.095%Quebec− − · −
R183.846%5.987%Romeo· − ·
S193.846%6.327%Sierra· · ·
T203.846%9.056%Tango
U213.846%2.758%Uniform· · −
V223.846%0.978%Victor· · · −
W233.846%2.360%Whiskey· − −
X243.846%0.150%X-ray− · · −
Y253.846%1.974%Yankee− · − −
Z263.846%0.074%Zulu− − · ·

Frequently Asked Questions

When mapping a 32-bit random integer (range 0 to 4,294,967,295) onto 26 letters via modulo, the first 22 letters (A - V) each map to 165,191,050 values while the last 4 (W - Z) map to 165,191,049. This creates a bias of approximately 0.0000006%. Rejection sampling discards any random value ≥ the largest multiple of 26 that fits in 2³², then redraws. The practical impact is negligible for casual use, but matters in cryptographic or statistical applications where provable uniformity is required.
For k unique letters drawn from 26, the number of distinct ordered sequences is P(26, k) = 26! / (26−k)!. For k=5, that equals 7,893,600 possible sequences. The probability of an exact repeat on two consecutive generations is 1/7,893,600 ≈ 0.0000127%. For the full alphabet (k=26), there are 26! ≈ 4.03 × 10²⁶ permutations - a repeat is effectively impossible.
Math.random() uses a PRNG (typically xorshift128+ in V8) that is fast but predictable if the internal state is known. It is not suitable for any application requiring unpredictability (security tokens, fair game draws, unbiased sampling). crypto.getRandomValues() draws from the OS entropy pool (e.g., /dev/urandom on Linux, CryptGenRandom on Windows) and produces cryptographically secure pseudorandom numbers. For a letter generator, the practical difference is minimal, but using CSPRNG costs almost nothing and guarantees no exploitable patterns.
The tool includes presets for English (26 letters), vowels only (5 letters: A, E, I, O, U), and consonants only (21 letters). Custom alphabet support allows entering any set of characters. The underlying algorithm is alphabet-agnostic - it selects a uniform random index from whatever character array is provided. The alphabet size n simply changes the modulo divisor and rejection threshold.
The algorithm creates a copy of the alphabet array. For each position i from 0 to k−1, it generates a random index j in [i, n−1] and swaps elements at positions i and j. After k iterations, the first k elements of the array are a uniformly random permutation sample. This runs in O(k) time and O(n) space. It avoids the retry-on-duplicate approach (which degrades to O(n·ln(n)) as k approaches n) and guarantees termination in exactly k steps.
No. This generator produces uniform distribution where each letter has exactly 1/26 probability. English text frequency (where E appears ~12.7% and Z ~0.074%) reflects natural language patterns, not random sampling. If you need frequency-weighted random letters that mimic English text distribution, you would need a weighted sampling algorithm with a cumulative distribution function - a different tool entirely. The reference table above lists both the uniform generator probability and English corpus frequency for comparison.