Skip to main content
4 of 4
Commonmark migration

TI-Basic, 39 bytes

sub("ABCDEFGHIJKLMNOPQRSTUVWXYZ",int(26^rand),1

rand generates a uniform value in (0,1]. This gives 26^rand a different probability to equal the integers from 1 to 26.

Older version, 45 bytes

sub("ABCDEFGHIJKLMNOPQRSTUVWXYZAAA",1+int(4abs(invNorm(rand))),1

Limited precision of the TI-Basic integers limits normal distributions to generating numbers within µ±7.02σ (see randNorm(). So we get the absolute value of a random number with µ 0 and σ 1, multiplying by four to increase the practical range mentioned before to µ±28.08σ. Then, we floor the value and add 1, since sub( is 1-indexed, giving us a range from 1-29 with different probabilities of each.

Timtech
  • 12.6k
  • 2
  • 46
  • 61