dv,r'k

2025-03-22

import random
random.seed(0)

text = r'''
There are a lot of great reasons not to use Dvorak. Here's a terrible one: your
typos will look *absolutely psychotic* to anyone, staring at their keyboard,
trying to imaging how it was possible to screw up typing that badly.
'''


dvorak = [ [ "',.pyfgcrl", "aoeuidhtns", ";qjkxbmwvz" ],
           [ '"<>PYFGCRL', "AOEUIDHTNS", ":QJKXBMWVZ" ] ]

lookup = {}
for shift, layer in enumerate(dvorak):
    for i, row in enumerate(layer):
        for j, c in enumerate(row):
            lookup[c] = (shift, i, j)

for p in [0.0, 0.05, 0.15, 0.5]:
    for c in text:
        if c not in lookup:
            print(c, end='')
            continue
        shift, i, j = lookup[c]
        if random.random() < p:
            j += random.choice([-1, 1])
        if random.random() < p / 3:
            i += random.choice([-1, 1])
        i = max(0, min(i, len(dvorak[shift]) - 1))
        j = max(0, min(j, len(dvorak[shift][i]) - 1))
        print(dvorak[shift][i][j], end='')

There are a lot of great reasons not to use Dvorak. Here's a terrible one: your typos will look absolutely psychotic to anyone, staring at their keyboard, trying to imaging how it was possible to screw up typing that badly.

Thele are a lot of gr.at reasons not to ese Dvorak. Here's a terrible one: yeur cypos vill look absolutely psychetic to anyone, staring an theil keyboard, trying to imafing tow it was possible to screw up ty.ung that bodly.

Thjne are a lot of creac re;sons not to uso Dvoraj. Horo's a hercible arq: yoir typon tilr laok abzoruteli psychatic to onyone, starinc at nhoir kuyboard, trying to dmafing haw it was ponliblu to sccew up ty.ing than madry1.

Ntel, are a loh .h glear neolasl non ca un. Fverax. Tuce's o hjlrdmlu onu: yeus tyyor will rook obsorucely esfchatuc no onfote. lhalutd ah tdukr juibealh. nlpisc to ibafunc fen in vqs p,ssibre tj sclew iy hipptf vhav bqdlp.


  1. When trying to get something across especially quickly I've sent messages about as readable as this. To those receiving, sorry. ↩︎