Simba Code:
function TSAPosition(TSA: TStringArray; text: string): Integer;
var
h: Integer;
begin
h := High(TSA);
for Result := 0 to h do
if (text = TSA[Result]) then
Exit;
Result := -1;
end;
function Typo(str: String; odds: Integer): string;
var
Keys:T2DStringArray;
str2, keylist:TStringArray;
tempr:string;
posi, i:Integer;
begin
KeyList := ['q','w','e','r','t','y','u','i','o','p','[',']','a','s','d','f','g','h','j','k','l',';','z','x','c','v','b','n','m',',','.','/','?','!','1','2','3','4','5','6','7','8','9','0'];
SetLength(keys, 44);
Keys[0] := ['1','2','w','s','a']; //q
Keys[1] := ['2','3','e','d','s','a']; //w
Keys[2] := ['3','4','r','f','d','s','w']; //e
Keys[3] := ['e','4','5','t','f','d']; //r
Keys[4] := ['r','4','5','6','y','g','f']; //t
Keys[5] := ['t','5','6','7','u','h','g']; //y
Keys[6] := ['y','6','7','8','i','j','h']; //u
Keys[7] := ['u','7','8','9','o','k','j']; //i
Keys[8] := ['i','8','9','0','p','l','k']; //o
Keys[9] := ['o','9','0','-','[',';','l']; //p
Keys[10] := ['p','0','-','=',']']; // [
Keys[11] := ['[','-','=','\']; // ]
Keys[12] := ['q','w','s','x','z','s','w']; //a
Keys[13] := ['a','q','w','e','d','x','z']; //s
Keys[14] := ['s','w','e','r','f','c','x']; //d
Keys[15] := ['d','e','r','t','g','v','c']; //f
Keys[16] := ['f','r','t','y','h','b','v']; //g
Keys[17] := ['g','t','y','u','j','n','b']; //h
Keys[18] := ['h','y','u','i','k','m','n']; //j
Keys[19] := ['j','u','i','o','l',',','m']; //k
Keys[20] := ['k','i','o','p',';','.',',']; //l
Keys[21] := ['l','o','p','[','/','.',',']//;
Keys[22] := ['a','s','d','x','c']; //z
Keys[23] := ['z','a','s','d','c']; //x
Keys[24] := ['x','s','d','f','v']; //c
Keys[25] := ['c','d','f','g','b']; //v
Keys[26] := ['v','f','g','h','n']; //b
Keys[27] := ['b','g','h','j','m']; //n
Keys[28] := ['n','h','j','k',',']; //
Keys[29] := ['m','j','k','l','.']; //,
Keys[30] := [',','k','l',';','/']; //.
Keys[31] := ['.','l',';']; // /
Keys[32] := ['.','l',';']; // ?
Keys[33] := ['q','w','2']; // !
Keys[34] := ['q','w','2']; // 1
Keys[35] := ['1','q','w','3']; // 2
Keys[36] := ['2','w','e','4']; // 3
Keys[37] := ['3','e','r','5']; // 4
Keys[38] := ['4','r','t','6'] //5
Keys[39] := ['5','t','y','7'] //6
Keys[40] := ['6','y','u','8'] //7
Keys[41] := ['7','u','i','9'] //8
Keys[42] := ['8','i','o','0'] //9
Keys[43] := ['9','o','p','-'] //0
SetLength(Str2, Length(Str));
For i := 1 to Length(Str) do
str2[i-1] := Str[i];
for i := 0 to high(str2) do
begin
posi := TSAPosition(KeyList, str2[i])
case random(80) of
0..1: tempr := tempr + Keys[posi][Random(high(Keys[posi]))];
2..100: tempr := tempr + str2[i];
end;
end;
result := tempr;
end;
begin
Writeln(typo('this function has pissed me off for the last time', 1));
end.