84
\$\begingroup\$

Write a program or function that transforms an input string into Zalgo text.

For example, for an input string Zalgo, a possible output might look like:

Z̗̄̀ȧ̛̛̭̣̖̇̀̚l̡̯̮̠̗̩̩̥̭̋̒̄̉̏̂̍̄̌ģ̨̭̭̪̯̫̒̇̌̂o̢̟̬̪̬̙̝̫̍̈̓̅̉̇

Zalgoification specs

  • Each letter (upper or lower case) must be zalgoified, and nothing else (spaces, punctuation).
  • The combining characters that can be placed on letters here are all those between U+0300 ̀ and U+032F ̯
  • Each letter must have a total number of combining characters on it (above and under combined) which is randomly chosen according to a normal distribution of mean 10 and standard deviation 5 (If a negative number is chosen, 0 combining characters must be added).
  • Each combining character placed on a letter is chosen uniformly at random between the 48 possible combining characters (see 2nd item).

Inputs, Outputs

  • Input is a single line string that contains only characters between ASCII 32 (space) and ASCII 126 (tilde). No line breaks. You may assume there is at least one letter in the string. The input can be taken as command line argument, function parameter, or STDIN.
  • Output is the Zalgoified string. It can be written to a file, or printed to STDOUT, or returned from a function. A trailing line feed is fine. The output doesn't have to display properly in your interpreter/whatever, as long as when you copy it to a Stack Exchange answer it displays properly like here.

Test cases

  • The Zalgo example above.
  • Input: Programming Puzzles & Code Golf

Possible output:

P̢̭̟̟̮̍̅̏̍̀̊̕̚̚r̢̫̝̟̩̎̔̅̈̑o̡̠̣̪̠̍̈̐̏̌̆g̡̬̯̟̠̩̎̐́̅̚ȑ̢̨̩̠̙̭̤̩̟̔̕ą̟̟̯̠̪̜́̉̒̎̂̍̃́̚̚̚m̪̈̅̈m̨̛̛̪̤̟̔̍̓i̢̛̬̠̠̇̈̂̓̒̀̋̔̚̚n̛̝̩̜̓̐̑̅̅g̨̩̪̊ P̨̧̢̟̙̮̋̆ų̨̙̞̙̫̤̫̭̊̓̒̃̒̚z̜̤̮̪̫̄̌̃̈̉̑̋́̕z̡̥̯̠̬̜̥̑̌̓̌̋́̅ľ̫̙̟̪̖̉ė̢̨̘̦̘̖s̛̜̙̘̚ & C̨̠̟̯̟̙̠̉̄̄́̄̑̈̔̆̀ö̭̟̗̯̥̏̐̄̏̌d̞̬̀̆́̀é̟̙̩̗̙̣̋̎̌̌̋ Ğ̨̡̧̡̣̪̝̝̘̩̮̉̋̀̉̉̕̕ọ̠̠̘̟̑̇́̀̃̎̓̋̚ḽ̡̢̟̪̥̍̍̅̀́̎̆̕f̧̢̪̠̠̀̉̒̍̍̊́

  • Input: Golf is a club and ball sport in which players use various clubs to hit balls into a series of holes on a course in as few strokes as possible.

Possible output:

Ǧ̡̧̄̐̊ò̡̞̟̖̌́̄́̆̈̒l̡̬̣̜̫̞̘̪̇̈̏̊̆̃̑̉̓̒f̙̐̍̇́̐̍̉ į̦̘̝̣̊̒̎̚s à̡̛̠̜̙̣̙̞̣̗̯̝̘̩̅̊̓̄̒̃ ć̬̗̫̯̫̎́̚l̒̎̋ű̯̜̑̎b̯̣̮̭̤̃̊́ a̡̨̟̘̭̣̍̈̀̃̎́̐̋̆̂ń̨̖̭̝̬̘̦̣̓̇̚̕d̨̤̣̙̜̪̖̪̍̓̔̍̔̃̒̍̆̏̚̚̕̚ ḃ̬̪̇̕a̡̟̖̬̬̖̬̋́̎̎̔̄̏̒̑̚l̨̖̜̬̠̭̭̇l̡̡̛̛̬̤̆̔̑̍ s̠̙̣̠̖̜̜̅p̤̖̃́̅̕̕ǫ̢̥̬̠̞̭̭̘̟̞̋̊̌r̡̛̞̬̈̇̑̎̄̚t̟̩̏̀ ï̡̧̢̨̜̜̝̝̜̜̫̔̇̂̔̐n̞̖̫̪̟̤̦̫̂̓̍̑̆̒̚ w̨̧̟̠̯̜̙̘̏̎̈̆̂̅̔hi̧̝̖̗̖̒̆̆̈̚ć̪̜̫̖̠̣̞̋̈́̀̌̋h̢̢̨̥̮ p̜̣̋̔̆l̨̧̛̘̫̝̙̠̯̂̑̌̈̒̐ā̩̗̟̐ẏ̢̛̫̠̦̤̫̞̦̯̥̜̀̀̈̅̉̈̄ẹ̡̑̔̄̉̀̎̒̑r̛̫̭̤̋̄̓̀̅̓ș̜̯̆̋̒̍̔ ų̛̘̭̜̝̈̃̂̅̌̍̆̚s̡̡̡̨̫̥̪̋̈̀̀̆ê̢̡̡̥̖̮̞̫̪̥̘̥̯̎́ v̡̢̢̟̠̞̬̥̩̣̫̫̦̞̂̐̓̇ặ̢̧̙̝̥̪̗̆̎̓ŗ̦̙̩̑̒̕í̫̣̊̚ō̡̧̤̘̟̩̠̫̗̃̍̉̊̕ụ̡̪̠̈̈́̊̅s̢̢̘̤̝̪̀̎̅ c̡̢̛̖̫̗̑̒̆́̎̚l̥̥̖̘̉̎̓̔̀̔ų̘̘̣̟̃̆̓̉̏̅̓̂́̇b̡̝̗̙̗̮̖̩̗̦̏̌̏š̛̮̣̮̜̒̓̌ ṭ̣̫̗̮̙̈̔̅̂̎̃̌̈ò̮̘̍̅̃̃̅̚̕ ḩ̜̞̮̠̇i̮t̝̗̦̖̮̞̗̩̞̤̎̍̒̐ bȁ̢̮̩̝̣̉ļ̛̮̘̏ĺ̨̖̮̑s̢̬̪̗̬̖̟̅̀ i̢̗̖̊̃ń̨̧̛̫̮̞̎t̡̗̞̩̙̑̐̏̔̏ơ̧̯̮̦̖̇̆̔ ạ̧̉̍̚ s̤̬̫̠̉e̎̃r̟̪̥̗̜̥̍̆̍̇̕̕i̧̧̭̝̫̪̯̖̞̪̅̇̎̈̐̅̍ȇ̟̬́̄̃̐̊̕s̢̢̛̝̤̙̭̘̩̩̍̑̂̈̀̀̍̄̔̒̒ o̡̢̘̩̣̅̐̆̌̂̉̇̆̋̕f̡̯̜̝̘̮̠̖̐̂̒̃̚̕ h̪̘̫̪́ǫ̭̦̔̋̆̚̕l̢̡̧̨̙̯̤̔̅̓̆̑̍́ȅ̪̬̝̙̅̋̍s̪̖̭̫̪̟̖̐̀̕ ǫ̦̠̫̍̊̉̄̚n̐̎̂̀ ą̡̛̛̤̦̪̣̭̈̐̂̎ c̪̩̠̗̟̜̘̐̂̈̐̑̏̈ọ̡̡̙̫̞̜̐̇̄̓̏u̥̖̙̝̔̂̎̅̚̚r̙̜̬̭̠̮̙̙̪̫̝̙̬̥̥̯̐́̈́̊̈̍̍ș̀́e̞̜̒̌̚ ĩ̧̦̝̪̆n̛̞̞̆̆̀ a̟̅̐̈̍̉̚̚̕ş̫̭̍̐̚ f̘̝̠̪̦̜́̌̍̇̀̕e̩̫̣̊̎̇̚w̪ ŝ̨̨̠̠̝̦̣̜̦̗̮̞̞̥̥̅̄̄̕t̢̡̢̙̞̟̩̭̤̅̎̌̒̃̇̕r̞̤̙̄̊̃̇̅̈̏̈̌ǫ̝̬̀̋̏̐̌̈k̡̢̧̪̭̝̙̆̈̒̀ȩ̛̙̣̠̗̞̮̅̅s̙̣̒̉̎́̂̅ à̧̛̖̘̞̫̘̎̃̀̑̎̕̕s̢̟̟̭̩̈̏̇ p̣̟̭̗̪̜̫̦̝̣̎̋̎̀̐̏o̧̢̪̮̤̦̎́̐̒̀̚̕s̛̯̦̗̬̬̊̊̄̓̐̉̏́̚s̢̠̣̬̥̬̔̅̕̕i̡̠̣̣̫̞̣̮̥̟̅̎̇̄̋̌̌̇b̡̧̡̖̖̃̄̋̈̋l̢̢̙̪̣̉̉̐̑̆ẹ̢̒̎.

Scoring

This is , so the shortest answer in bytes ẁ̨̛̭̙̥̖̏̏̐̐̉̃̅̚i̜̟̭̤̞̘̗̐̐̔̈̍̋̏̚n̘̯̥̩̗̯̠̘̮̋̈̃̀̊̉̎̈̕s̛̬̦̙̮̩̜̄̑̐́̎̆̚.

\$\endgroup\$
  • 2
    \$\begingroup\$ First issue I have when attempting this. How to create a set of numbers that conform to a known mean and standard deviation? \$\endgroup\$ – Luminous Sep 11 '15 at 15:13
  • 4
    \$\begingroup\$ @Luminous The vast majority of languages have built-in or libraries to roll random numbers that follow a normal distribution. If your language of choice only has uniform distribution random numbers, there are ways to use them to get a normal distribution (e.g. this or this) \$\endgroup\$ – Fatalize Sep 11 '15 at 15:16
  • \$\begingroup\$ I'm not sure how Zalgoification works, but does it work on numbers as well? and if so, do we have to apply it to numbers here as well? \$\endgroup\$ – Nzall Sep 11 '15 at 22:10
  • 52
    \$\begingroup\$ ... You called? \$\endgroup\$ – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ Sep 12 '15 at 14:43
  • 2
    \$\begingroup\$ @DigitalTrauma It does display properly for me in the hot questions... \$\endgroup\$ – Fatalize Sep 13 '15 at 5:56

13 Answers 13

38
\$\begingroup\$

CJam, 57 56 49 47 bytes

Thanks to Sp3000 for saving 7 bytes.

q{_eu_el={Pmrmc1.mrml-50*mq*A+mo{48mr'̀+}*}|}/

Test it here.

Explanation

This uses Box–Muller for the normal distribution: the basic algorithm generates two uniform variables in the range [0,1), U and V and then computes two normally distributed values from them. We only need one and the simpler one is X = √(-2 ln U) cos(2πV). This generates a distribution with mean 0 and standard deviation 1, so we need to multiply it by 5 to correct the standard deviation and add 10 to correct the mean. We can also simplify the cosine, because omitting the 2 gives the same distribution. So we compute X = √(-50 ln U) cos(πV) + 10 before rounding to get the number of combining marks.

Here is the code:

q{          e# For each character in the input...
  _eu_el=   e#   Make an upper case and a lower case copy and check if they are equal.
  {         e#   If they aren't... (i.e. if this is a letter)
    Pmr     e#     Generate a uniformly random value in [0,π).
    mc      e#     Take the cosine.
    1.mr    e#     Generate a uniformly random value in [0,1).
    ml      e#     Take the natural logarithm.
    -50*    e#     Multiply by -50.
    mq*     e#     Take the square root and multiply by the cosine.
    A+      e#     Add 10.
    mo      e#     Round to nearest integer.
    {       e#     That many times...
      48mr  e#       Generate a uniformly random integer in [0,47].
      '̀+    e#       Add it to the first combining mark.
    }*
  }|
}/

This means we just dump all the characters and combining marks on the stack in the correct order, where they are printed automatically at the end of the program.

\$\endgroup\$
  • \$\begingroup\$ Little nitpick, your code uses ̀, which is ̀, or codepoint U+0300, combining grave accent. This requires two bytes in UTF-8: 0xCC 0x80. Your code has 47 characters, but 48 bytes. Other than that, brilliant piece of work! \$\endgroup\$ – Abel Sep 12 '15 at 16:44
  • 2
    \$\begingroup\$ @Abel Thanks but I think you miscounted the characters: it's 46 characters and 47 bytes. \$\endgroup\$ – Martin Ender Sep 12 '15 at 16:45
  • \$\begingroup\$ Oh darn, you are right! I checked column number in my editor, it showed 48, but it starts at +1... \$\endgroup\$ – Abel Sep 12 '15 at 16:46
  • 1
    \$\begingroup\$ @tchrist "Input is a single line string that contains only characters between ASCII 32 (space) and ASCII 126 (tilde)." ;) \$\endgroup\$ – Martin Ender Sep 12 '15 at 21:54
  • 2
    \$\begingroup\$ Looks like CJam needs a normal distribution function :) \$\endgroup\$ – lirtosiast Sep 12 '15 at 22:02
14
\$\begingroup\$

Python3, 162 156 bytes

from random import*
q=lambda z:''.join([v,v+''.join(choice(list(map(chr,range(768,815))))for i in range(int(normalvariate(10,5))))][v.isalpha()]for v in z)

Possible usage:

print(q(u"Programming Puzzles and Code Golf"))

I import random, generate a string of all combining characters, return a random subset of combining characters according to mean 10, stddev 5 normal distribution and append to each alpha letter in then string, then join the results.

Test input:

Programming Puzzles and Code Golf

Test Output:

P̡̣̝̬̞̃̏̋r̫̤̒̇̋̂̉̔̂̕ó̘̫̔g̭̤̝̖̅̏̍̆̇̍ȑ̮̭̃̎̒̄̅̊̚ḁ̉̅̎̑m̧̠̤̎̒̅̂̓̒m̨̮̏̐̓̐̇ī̘̌́̄̆̋̏̉̇ń̝̀̑̔̅̏́̑̕g̢̞̬̥̜̩̖̎̍́ P̨̞̮̭̂̄̄ử̝̔̍̋̀̕zž̧̥́l̩̫̣̉̊̍̋̐̊̌ĕ̡̛̤̖̤̄̅̈̚s̨̨̞̝ ą̙̦̖̄̓̊̌̉̌n̢̙̜̪̤̣̪̔d̘̙̠̝̫̭̜̑̔̕ C̢̛̝̦̬̝̈̄̏̏ȏ̡̇̓̐̎̆̉̌̄d̗̝̞̤̟̭̓̐̈̕ė̡̛̜̥̥̠̟̦̌ G̖̟̘̅̄̈́̚o̧̗̬̗̥̞̙̐̌̊l̢̞̖̟̑̇f̢̛̩̀̒̃̌̈

\$\endgroup\$
  • \$\begingroup\$ I applied all the suggestions from @FryAmTheEggman suggestions which cut it down to about 161 bytes. \$\endgroup\$ – swstephe Sep 11 '15 at 21:15
  • 2
    \$\begingroup\$ This zalgoifies non-alphabetic characters \$\endgroup\$ – DankMemes Sep 11 '15 at 21:40
  • \$\begingroup\$ This should fix the non-alpha problem. \$\endgroup\$ – FryAmTheEggman Sep 11 '15 at 22:37
  • \$\begingroup\$ Thanks @FryAmTheEggman, I somehow misread the discription to say space and tilde were the only non-ascii characters in the input. But now I see that it means any characters. I used your hint, but took away one character by switching the order. \$\endgroup\$ – swstephe Sep 12 '15 at 1:19
  • 1
    \$\begingroup\$ The u prefix is not needed in python 3. Unless you're mixing byte strings with Unicode ones. \$\endgroup\$ – Kevin Brown Sep 12 '15 at 14:07
13
\$\begingroup\$

MATLAB, 89 bytes

Credits go out to DankMemes, but as I am not able to comment yet I'm forced to place my improvements w.r.t. his MATLAB submission in a separate answer.

function o=z(a),o=[];for c=a,o=[o,c,randi(49,[1,isletter(c)*fix(normrnd(5,10))])+767];end

Slightly more golfed by replacing the newlines with commas and semicolons (which also suppresses the intermediate outcomes from the loop).

  • 9 bytes can be won by replacing isstrprop(c,'alpha') with isletter(c).
  • We don't need the dots in front of * and +, as we multiply with a scalar. That's another 2 bytes.
  • fix instead of floor for 2 bytes. It does give a slight bias towards 0 though, so alternatively ceil can be used to gain 1 byte.
  • I changed the random character pick to work with random integers between 1 and 49 to reduce the amount of operations and save some additional bytes.

Using it with

z('Simple check for proper functionality results in this beautiful text!')

Results in

Ś̜̬̭̃̑̓́̃i̩̰̗̙̫̜̇̀̑mplë̥̟̣̩̙̗̐̌̇ cḧ̢̛̰̝̣̝̋̋̑eç̛̞̖̖̰̰̝̭̞̜̝̥̋̎̇̄̂̆̆̔̎̊k̢̟̠̞̈̌̂ for̢̡̫̥̩ ṗ̝̥̗̬̯̯̝̍̑̈̊rop̡̡̨̢̝̫̤̠̫̠̏̎̄́̒ė̦̋̕ŕ̦̣̇̊ f̧̜̦̏̏̉̇unc̨̢̗̟̙̩̝̠̄̈̋̑̏̎̄̇̌̒́̇̚ti̝ỏ̧̯̰̥̣̜̎̓̀̊̔̒̉̔̑̑̔̋̚n̡̘̠̮̤̖̥̤̂̔̇̇al̩̫̇̇̔it̫̮̔̎̕y̡̰̰̦̔̇̏̎̋ r̛̙̯̉ĕ̬̟̉̓̌s̛̝̝̭ul̨̧̧̛̙̤̥̜̟̞̔̓̓̊̀̂t̡̠́̓̀̉̎̒̈̚ş̗̠̋̍̏̌̎̕ ǐ̛̗̭̪̤̃̏̍̎̈̓̐̚n̞̮̞̬̝̭̎̔̍ th̢̧̛̬̬̖̠̗̮̰̠̖̖̠̞̦̞̎̄̓̎̇̆̚̕is̟̬̍̂̎ bea̭̗̝ṳ̝̞̠̦̣̤̦̅̂̒̄̒̔̉̏tỉ̪̩̅̓̂f̢̝̰̬̤̰̊̊̉̎̕̕u̡̝̇l tex̰̤̥̍̕t̡̝̥̣̟̩̟̉̂̆̋̈̈̈̍̔!

\$\endgroup\$
  • \$\begingroup\$ Instead of using normrnd, you can save 3 bytes by using 10+5*randn. Note that no parentheses are required to call randn. \$\endgroup\$ – feersum Sep 12 '15 at 9:07
  • \$\begingroup\$ I accidently downvoted this, how can I retract my vote that is now "locked in"? \$\endgroup\$ – Reut Sharabani Sep 12 '15 at 16:06
  • \$\begingroup\$ @feersum Funny that you mention it. I actually tried it, but the distribution for a large number of repeats didnt' seem right to me. Try it for like 1e+6 values and see for yourself. \$\endgroup\$ – slvrbld Sep 12 '15 at 16:54
  • \$\begingroup\$ @ReutSharabani This is possible if someone edits the post. All votes are unlocked afterwards. \$\endgroup\$ – hiergiltdiestfu Sep 12 '15 at 23:04
  • \$\begingroup\$ @hiergiltdiestfu thanks, I thought there was some way... Sorry for the accidental downvote :-) I was on mobile and probably clicked it there. \$\endgroup\$ – Reut Sharabani Sep 12 '15 at 23:06
11
\$\begingroup\$

Javascript (ES6), 199 196 bytes

Uses a Box-Muller transform for the normal distribution (which ends up taking a lot of space, unfortunately. JS is not the best language when it comes to normal distributions)

i=>i.split``.map(e=>e.match(/[a-z]/i)?e+Array((i=~~((M=Math).sqrt(-50*M.log((R=M.random)()||.1))*M.cos(M.PI*R()||.1)+10))<0?0:i).fill().map(f=>String.fromCharCode(~~(R()*48+768))).join``:e).join``

Fiddle

Edit: I made a mistake and had to add one byte. This should now zalgoify capital letters as well as lowercase ones.

Edit 2: Simplified the transform as in Martin Buttner's answer.

\$\endgroup\$
  • \$\begingroup\$ You can shave 3 bytes by using a with statement: with(Math){i=>i.split``.map(e=>e.match(/[a-z]/i)?e+Array((i=~~(sqrt(-50*M.log((R=random)()||.1))*cos(PI*R()||.1)+10))<0?0:i).fill().map(f=>String.fromCharCode(~~(R()*48+768))).join``:e).join``} \$\endgroup\$ – Conor O'Brien Feb 25 '16 at 23:37
11
\$\begingroup\$

Perl, 81 79(?) bytes

Gee, you guys are all using variables! Who needs variables? :)

Here’s the simple code, which is just 79 bytes, most of it taken up by silly identifiers(but not variables :):

use Math::Random;s/\pL\K/(x x random_normal 1,10,5)=~s,.,chr 768+rand 48,reg/eg

Which, written more normally without compression, might be:

use Math::Random;
s{ 
    \pL         # find a Letter
    \K          # and Keep it, so the insertion point is right afterwards
}{
    # make a string of x's and replace each with a random combining character
    ("x" x random_normal(1,10,5)) =~ s{
            .  # take any character, including our x
        }{
            chr( int(768 + rand(48)) );
    }xreg;
}xeg;

How It Works

  1. Load the Math::Random module, importing the random_normal function.
  2. For each letter of the input:

    1. Get 1 random real number from a normal distribution whose mean is 10 and whose standard deviation is 5.
    2. Create a string containing as many x’s as the integer truncation of that random normal real number.
    3. For each of those x’s:
      1. Generate an evenly distributed random real number in the range [768, 768+48).
      2. Derive the character whose code point is the integer truncation of that random number.
      3. Replace the current x with that character.
    4. Place the resulting string of combining characters after that letter.

How to Count?

But I’m not quite sure how to count it because I’m not clear on the output requirements and the function requirements and how these impact counting.

File Execution

The solution above transforms its input and leaves the result where it is using the normal input space as with sed. If you want it printed, you would need to add a -p switch.

So for example, if you put that in a file named zalgo then you could test it this way:

echo These are not the zebras you are looking for. |
perl -p zalgo

which produces



T̛̝̠̟̙̭̗̮̘̠̪̖̤̍́̇ĥ̫̞̥̙̞̈̈e̢̨̛̟̥̥̫̐̒̄s̛̮̊̒̆́ę̨̛̪̗̝̙̥̘̯̈̃̏̑̄̆̍ à̢̨̖̫̟̮̂̍̒̍̓ř̛̜̌̎̅ȩ̛̗̣̗̬̒̉̄̇̉ n̥̟̪̪̙̞̠̝̪̄̓̅̈̎ȏ̧̭̭̫̤̥̒̉ţ̛̛̜̅̔̏̍̆̓̊̔̍̍̕ t̝̬̜̫̦̜̭̄̀̂̈̎ȟ̛̗̭̌̏̐̍̀̚ē̯̬̙̖̘̒̕ z̡̨̛̯̠̥̪̣̤̟̐̍̀̉ë̬̫̪̟̟̔̚b̗̝̣̎́̚r̞̟̋ã̢̛̪̪̗̝̞̝̃̄̄s̡̢̧̛̙̖̙̘̊̐́̀̎̚ ÿ̢̪̥̤̮̫̏̇̌̆o̡̜̝̓ŭ̜̖̦̥̦̞̑̏ á̡̤̫̞̟̥̘̒̔̋̑̐r̛̛̮̥̘̫̅ȩ̦̗̞̯̮̄́̂̈ ľ̠̉̈̀̒̚ò̖̘̖̉̋̀̊̔̏̇̕o̡̦̦̜̫̫̬̅̇́̌̏̚k̡̪̔̄̉̍̄̋̂̊ȉ̢̨̙̭̥̫̟̉̑́̏̌̚̚n̜̣̎̄̄̐̈̋g̖̞̭̘̜̞̑̂̃̅̅ f̡̧̡̛̤̓̀̏̚o̓ṙ.




I’ll revise the byte count once I learn how you’d like this to be counted.


Zalgotic Beowulf

If might be better to test this on something with more interesting letters so show that it doesn’t get stuck on some 1960s notion of what letters are. For example, it should be well-behaved on stuff like æþelingas. So given this text with the three first lines of Beowulf:

Hwæt, we gar-dena in geardagum,
þeodcyninga þrym gefrunon,
hu ða æþelingas ellen fremedon!

Here’s how to make a zalgotic Beowulf:

perl -p zalgo beowulf

Which emits:



H̝̙̓̒w̢̩̞̫̠̖̍̅̉̚̕̚æ̛̖̭̭̝̊̄̒t̢̬̩̒̑̑̇̔, w̨̢̢̘̥̎̆̑̉̐̇̃́̃̌ę̛̛̩̥̩̣̗̮̜̗̋̂̋̒̒̑̆̆̑̒̀ g̗̦̟̯̑ā̖̦̮̀̐̏̓r̢̫̄̈̊̉-d̨̗̪̜̃́̂̅̕ḙ̡̨̠̣̠̣̎̉̄̊̐̒̂̏̓̔n̟̤̫̓̄̉̓̔ą̗̪̃̈̔ i̡̤̤̣̠̮̍̚n̨̟̝̥̊̈̌̀̏̂̌̍ g̡̛̜̘̮̈̋̈̂̒̓̕e̢̞̤̐̒a̢̨̪̟̟̘̦̗̬̓̐̉̎́̏̓r̡̫̙̐̑̉ḋ̛̖̮̫̜̫̒ą̢̣̮̦̪̙̮̙̠̏̂̎̄̉́̅̚g̛̭̣̩̜̙̓̑̎̊̑̏̏u̡̢̞m̡̫̝̞̗̟̞̈̉̆̋̒,
þ̢̧̛̩̟̬̘̣̟̦̣̃̊̋̌̎ḙ̭̖̋̊́̎ọd̪̙̉c̝̭̩̦̠̓̅̅̍̐ỷ̖̞̥̦̐̍̏̄́n̬̥̥̣̗̂̀̄̕ĩ̡̡̗̞̩̗̋̒̆̏ṅ̢̢̫̬̝̑̉̌̈̌̐ĝ̥̭̬̤̇̂̅̎̂̅́̊̇ā̫̦̥̗̙̙́̀̕ þ̢̙̥̝̬̖̣̦̬̗̗̎̌̓̄̐̑r̡̢̨̯̬̮̝̮̜̩̃̉̅̐̀̑̓̐̉̈y̖̜̫̠̜̐̕m̧̟̜̣̘ g̢̧̪̗̫̘̖̃̍̓̑e̡̯̓f̛̬̥̔̌̒ř̨̜̙̠̥̒́̋ú̗̘̊̆̆̄̕̕n̢̛̜̫̍̐̐̋̉o̤̘̬̜̥̖̜̫̎̋̔̏̍̀̋̉n̨̧̮̆̑̅̇,
h̨̬̪̝̭̀́̐̕̚̚ú̜̖̭̭̯̘̗̠̊̊̆̌̀̀̕̕̕̚ ð̦̦̤̠̬̖̏̉̑̓̆̍̒̋̚̕ẳ̧̫̦̚ æ̯̙̘̣̯̋̆̑̑̀̅þ̢̝̣̯́̆̇̈̐̊̅̈ệ̗̙̣̙̪l̢̧̝̗̦̖̟̔̄̐̄̊̚i̡̬̝̘̜̍̉̏̑̍̊̐̋̔̉ņ̥̩̣̋̐̊̇̔̎̉̋̓ģ̝̬̯̪̥̞̪̃̅à̧̨̤̫̖̊̅̓̄̑̏̊̋̚̚s̨̡̥̭̞̙̎̓ ê̜̆̊̆́l̘̪̟̙̙̝̎̀́̂ľ̢̛̬̥̗̋̀̐̅̎̔̔̄̉ẽ̡̨̤̬̭̦̞̤̯̬̍̀̋̚ň̢̨̖̘̣̖̝̞̙̍̀̆̄̂̕ f̩̘̦̦̜̦̞̑̏̄̋r̘̓ẹ̤̠̟̀̅̔m̢̪̮̙̗̆̉̒̚̕̚e̎d̬̘̓̒̈̆̓̒̄̑̚ò̡̝̥̮̯̝̜̯̜̘̞̑̐̌̇̓̐n̪̣̗̤̈̎́̆̊!





All CLI, No Files

If you wanted to go all command line, you could inline it this way:

echo "This particularly rapid unintelligible patter isn’t generally heard and if it is, it doesn’t matter." |
perl -CS -MMath::Random -ple's/\pL\K/(x x random_normal 1,10,5)=~s,.,chr 768+rand 48,reg/eg'

and generate this from it:


T̢̜̪̜̬̥̝̂̉̆̈̏̏̒̂̋̊̕h̢̛̙̝̦̥̫̉̌̑̐̚į̧̧̪̀̉̌̐š̙̗̘̑̉̒̋̈̍̐̊ p̡̛̛̗̞̜̙̔́̊̊̊̆a̬̦̫̠̦̜̐̂̈́̅r̢̩̩̝̣̖̔̊̇̈t̢̘̫̪̜̄̍̏̌̄̚i̞̟̜̊̍̒́̄̂c̟̑̑̃̌̋ư̧̫̫̝̠̟̦̎̋̍̓l̛̥̞̖̟̩̈̋̈̍̍a̢̜̦̘̫̓̉̇̂̇̒̓̆ȓ̪̤ļ̬̫̟̣̬̬̆̃y̌ ŕ̩̞̟̖̝̬̟̪́̒̐̔ȧ̡̟̖̙̤̜́́̎̍̀̒̌̋p̪̤̦̜̒̉̈̌̌̆̇̉̚ỉ̧̡̟̪̔̔̀̈̅̆ḑ̖̣̐̆̍́̃ ṳ̩̗̫̦̦̗̤̅̃̒̊̆nį̧̢̫̪̦̩̞̞̎̉̅̇̆̔́̋̐̍ņ̡̧̛̩̘̪̪̪̎̈̕̕t̥̤̬̩̦̓̄̍̑̇̄e̡ĺ̢̠̓̂̇̅̐̚ľ̗̭̝̪̀̅̕í̤̬̥̙̭̠̊̅́̒ģ̩̬̣̃̐̆̇̓i̛̗̦̭̙̝̐̔̇̄̉̄̇bl̖̭̘̣̙̤̇̎̔̅̒̔̚e̘̤̖̞̎̎̅̍̕ p̧̢̡̟̠̜̬̩̃̀̆̃̆̍a̧̡̭̙̥̤̟̟̔̄̎̔̓̕t̖̦̎̊̏̉̕ţ̤̥̦̝̜̭̤̈̆̊̓̈̊̎̚ȇ̡̛̖̈̊̓̎̕r̟̫̍̒̅̈̈ i̧̘̪̠̟̗̙̭̍̇̄̊ş̛̩̖̦̬̞̣̤̘̫̓̊̆̈̌̓̐̎̕n̡̧̜̥̤̪̩̋̇’t̓̈̑̀̈̔̈̐̔̊̒ g̛̤̋̇̋ę̢̛̛̠̤̥̟̞̣̫̞̬̝̙̐́̂̂̍̕n̩̟̙̞̖̭̫̂̂̌̃̔̉̑ȩ̗̥̥̠̂̈̉̅r̪̫̩̂̀̄aḽ̢̜̖̝̌̇̓́̒̑ļ̢̧̫̦̥̬̤̑̎̒̒̓̑̚̚̕ỳ̛̥̖̭̍̐̃̑̍ h̖̬̠̠̝̜̝̪̗̒̊̊̋̄ȩ̛̞̭̪̜̤̟̘̣̅̆̃́̂̔a̛̝̕r̝̦̅̅̍̍̎̂̊ḑ̩̞̬̘̪̝̝̍̏̂̓̔̄̑̕ ą̡̧̬̞̝̟̍̓̉́̈̀ň̛̟̩̙̈d̡̜̥̣̦̫́̅̌̚ ĩ̖̜̔f̧̅̌ į̡̢̪̬̫̟̜̄̑̑̓̊̚̕̚t̪̘̦̩̐̄́̐ ỉ̥s̪̝̤̀̈̚, ǐ̪̭t̛̬̭̝̋̄̋̇̏̉̆̚̕̕ d̝̗̭̓̒̂o̡̝̙̒̅̒̏̉̚e̢̦̦̝̘̘̣̔̓ş̛̤̤̊̇̃̋̎ṅ̨̧̬̤̜̚’ţ̪̗̭̘̟̝̔̋̑̀̇̃̈ m̢̛̦̭̖̥̪̫̙̤̈̅̏̃̂̆̋̈̌̕ả̛̜̝̝̗̣̦̅̚t̫̤̜̘̒̅̅̚t̪̬̗̘̑́̔̓̏̅̉̆ȇ̡̦̘̣̘̭̖̞̥̄̔̑̆̂̃̀̀̍̇̉̚̕r̛̭̙̘̬̉̄̆̉̇̅́̕̕.




The Fine Print

To really make this work well, you may need to have something in your environment or on the command line or in the file to say this is Unicode throughout. That might be -CS or -CSD, or PERL_UNICODE=S or PERL_UNICODE=SD depending on which way you’re going at it. However, because the problem says we don’t actually have to print anything, and that the input is mere ASCII, these are not needed for the small specific case given in the problem description.

\$\endgroup\$
  • \$\begingroup\$ You should probably call this "Bash/Perl", because it really won't work in all command lines. \$\endgroup\$ – TheDoctor Sep 16 '15 at 15:54
  • \$\begingroup\$ @TheDoctor That doesn't make much sense to me. The Perl code is the same; how you manage to run it is up to you. \$\endgroup\$ – tchrist Sep 16 '15 at 17:07
7
\$\begingroup\$

Groovy, 201 196 182 174 170 154 146 130 129 124 bytes

My first golf, not really aiming to win here but figured I'd give it a shot anyway.

Run it as groovy zalgo.groovy 'input'

o='';r=new Random();args[0].chars.any{o+=it;if(it.letter)(r.nextGaussian()*5+10).times{o+=(char)(768+r.nextInt(48))}}print o

Ungolfed (with syntax highlighting):

// By making this a Groovy script, the weight of
// a full Java-like class definition can be avoided
////
// Originally, this part of the answer used the 'def'
// keyword to infer the type of the variable, but it
// turns out you can define a variable in Groovy
// without any type at all.
buffer = '';
rand = new Random();
// There used to be a for loop here using def, but now it's a
// .any closure. .any saves a byte over .each.
////
// Groovy automatically defines an args variable for
// scripts, which we use here.
args[0].chars.any {
    // As in Java, += works on a String. Previous versions of the
    // answer used a StringBuffer, but a String works just as well.
    buffer += it;
    // Another Groovy extension; we can use the primitive char like
    // a Character object, and use .letter instead of .isLetter()
    if (it.letter)
        // Since Gaussian is already a normal distribution with mean 0
        // stddev 1, we can fix that with a quick multiply and add.
        ((rand.nextGaussian() * 5) + 10).times {
            // I use the literal number '768' here, as it's the same size
            // as a Java char literal, and Groovy doesn't have char literals.
            buffer += (char)(768+rand.nextInt(48));
        }
}
// Finally, we can take a quick shortcut here by using the
// parentheses-less syntax for print in Groovy. Using print
// instead of println saves a whole two bytes!
print buffer

Example output:

P̊r̡̜̋̎̎̆ȍ̧̨̖̣̖̠̪̬̘̂̚g̩̯̗̈̃̆r̡̮̭̬̙̟̟̭̗̅̐̀̑̕ą̢̛̜̗̗̩̂̓̂̎̕m̝̬̊̂̒̐̕m̤̠̪̣̍̓̍̂̍̚į̫̣̞̝̬̪̘̟̎̅̒n̛̬̦̗g̝̦̏̇̏̀̆̓ P̨̨̡̉́̓̒̕ų̠̤̪̬̘̪̪̤̪̏̀̎z̛̜̀̒̐̕ž̛̙̮̩̔̌̉̉̎̍́̑l̨̡̤̗̮̜̣̬̩̜̜̭̦̈̒̊̃̊̌̉ȩ̘̬̖̞̗̦̘̪̬̇̅̅̈s̒̄́̌̎ & Ĉ̢̣̜̗̟̤̌̒ơ̡̜̪̖̫̂̉̍̆̐̊̇̔̍̕̚d̛̛̦̫̫̯̥̯̭̍̋̔̆̂̕ê̫̪̆̍̒̄ G̙̪̅ȏ̢̥̖̘̦̟̜̪̈̔̌̑l̯̘̞̅f̬̗

\$\endgroup\$
6
\$\begingroup\$

Moonscript - 118 117 112 110 105 96 bytes

This needs to be saved as Latin 1, but generates utf-8. It uses the central limit theorem to approximate the normal distribution. math.random! returns a number with a uniform distribution 0 to 1, which has a mean of 0.5 and a standard deviation of 1/sqrt(12). If we add 300 samples, we get a number with a mean of 150 and a standard deviation of 5, with an approximately normal distribution. We subtract 140, and the distribution now has the correct mean.

In utf-8, the character codes U+300 to U+32F are encoded as 11001100:10000000 to 11001100:10101111. So it is the byte 204 followed by a random byte 128 to 175.

r=math.random
=>@gsub '%a',(b=-140)=>
 b=b+r!for _=1,300
 @=@..@.char(204,127+r 48)for _=1,b
 @

This is a code block which returns an anonymous function taking one argument, the string, and returning the zalgo-fied version. Assuming this is saved in zalgo.moon, a full program that uses this would be:

print require'zalgo' io.read!

Edit:

  • Turns out it's cheaper to use char code 204 instead of an embedded Latin 1 character.
  • Can access string.char using a.char
  • Switch to command line args, rather than stdin.
  • use method for implicit parameter @.
  • Switch to a function that returns a value
\$\endgroup\$
6
\$\begingroup\$

MATLAB, 106 bytes

I thought I'd submit another answer from a language which actually has a built in normal distribution function. I don't think I've ever tried MATLAB before so this may not be the most golfed it can be.

function o=z(a)
o=[]
for c=a
o=[o c floor(rand(1,floor(normrnd(5,10)*isstrprop(c,'alpha'))).*48.+768)]
end
\$\endgroup\$
5
\$\begingroup\$

AutoIt - (sad) 219 bytes

dim $r=random,$f
for $u in stringsplit($i,"",3)
do
dim $a=2*$r()-1,$b=$a^2+(2*$r()-1)^2
until $b<1
$f&=$u
for $m=1 to $a*sqrt(-2*(log($b)/$b))*5+10
$f&=stringregexp($u,"\p{L}")?chrw($r(768,815)):""
next
next
clipput($f)

What's really bloating up the code is the distribution calculation. I cheated a bit by writing the output directly to the clipboard, because clipput is the shortest output function in AutoIt. The RegEx \p{L} matches all letters.


You have to supply the input using a global variable $i:

$i = "A study in scarlet."

yields

Ą̣̘̤̪̜̮̎̊ s̭̫t̡̢̢̡̢̩̝̙̍̏̂̇̎̍̂̈ǖ̮̮̭̬̋̕ḑ̦̗̟̄̀̒̌̂̕y̨̧̙̪̩̎̀̓̋ į̣̦̥̮̔̈̃̅̐̌n̗̜̑ s̘̦̞̘̗̠̣̤̏̊̐c̨̡̛̭̝̬̭̜̟̥̝̮̍̄̊̎̔á̡̬̤̠̦̠̗̟̆̍̄̈̕r̛̤̥̬̠̋̍̒̚ļ̨̞̫̤̆̊̋̑ë̟̪̝̞̑̌̎̆̓̇̇̀̚̕t̢̖̟̞̟̘̮̅̎̂̐.

\$\endgroup\$
  • \$\begingroup\$ +1 for autoit, I don't think I've ever seen it here before. \$\endgroup\$ – DankMemes Sep 15 '15 at 1:08
4
\$\begingroup\$

Javascript, 190 169 136 bytes

function q(z){var o="",r=Math.random;for(var v in z){o+=z[v];for(var k=0;k<r()*100;k+=r()*10){o+=String.fromCharCode(768+~~k)}}return o}

usage :

var d=q("There is snow on the ground \
And the valleys are cold \
And a midnight profound \
Blackly squats o'er the wold; \
But a light on the hilltops half-seen hints of feastings un-hallowed and old. \
")

output :

...

T̡̗̙̀̅̎h̀è̇̋r̖̀̄̉̍̔̕è̀̅̉̏ ̀ì̘̟̥̫̱̀̇̐s̖̟̦̀̀̀̉̊̍ ̗̀̇̉̎̕s̗̀̃̈̊̑ǹ́̈̍̏̐ò̅̈̎ẁ̃̅̋ ̀̉ò̜̟̦̬́̄̌̓ǹ̘̀̉̌̍̒ ̛̝̀̈̒t̀̀̀h̘̀̈̐è̇̊̋̍̐ ̙̝̥̪̮̱̀̂̋̔g̗̀̉̒r̖̀̉̑ò̅̋̎̏̓̓ù̙̈̋̑ǹ̄d̖̀̉̏̑̔ ̀̆̊̍̕ ̀́̆̍ ̛̀̂̂̆̍̏̕ ̀̉̎ ̀̈̌̍̒À̖̜̠̅̍̏ǹ̀d̀́ ̀t̢̙̀̆̎̐̓h̜̤̤̀̈̉̊̊̏̓è̢̘̣̈̋̎̓ ̀̂̄̅̇̍̎v̗̙̀́̄̋̍̓̓̔̚à̛́̅̋̎̓̚l̀̂̊l̀̀̆̎̕è̗̈̑̕ỳ̃̊̍s̀̀̅̉̑ ̀̀̂̈à̈̊̌̎̑̒r̢̢̘̤̀̂̃̃̋̑̓è̖̗̇̉̏ ̀̈̈̍̎̑c̀̃̈̏ò̄l̀̆̍d̀̅̈̉ ̀̉̒̓ ̷̡̨̙̥̬̮̰̀̄̍̒̿̓͌̕ ̛̀̉̌̒ ̀̃ ̀́̈̊̐̑À̈̊̏̏̑ǹ̂̌̎d̖̀̉̑̕ ̙̀̃̆̋̔à ̖̀̀̄̆̌̍̕m̛̖̀̃̄̇̇̍ì̀̄̅̆̋̕d̀̈̊̏̕ǹ̀́̇̉ì́̊̎̕g̘̘̀̇̍̑h̗̟̟̀̅̎t̜̞̣̀̀̃̋̍̏̒ ̛̖̀̇̍p̖̟̥̀̈̍̓̚r̛̠̀̅̍̍̕ò̢̖̜̃̄̎̎̓̓f̘̙̜̀̂̇̊̒ò̙̅̉̐̕̚ù̡̖̙́̂̈̉̋̔̔ǹ́̇d̀̂̇̇̉ ̘̘̀̄̇̑ ̨̖̖̗̣̀̄̆̊̏̑̑̚ ̀̉̒ ̀̀̅̈̋̑ ̢̗̙̀̀́̅̍̎B̀̆̋l̤̫̀̀̇̍̔̚̚à̂̃̋c̀̄̄k̜̥̪̀̄̇̋̎̓̓l̀̂̉̊̐ỳ̃ ̖̘̀̉̍̎̐s̀̆̇̊̑q̀́̂̄̄̇̍ùà̈̎̑t̀̂̅̈s̀̀̀́̃̅̅̍ ̛̀́̂̇̉̌̓̔ò̅̅̇̇'̀́̄̇è̄r̡̛̀̀̈̈̒ ̀́̉t̀̀̂̊h̀̂̆è̢̂̋̔̚ ̀̀́̄ẁ̞̦̫̰̀̇̌̍̕ò̂̃̄l̝̀̇̎̏̒̒̕̚d̘̜̜̞̥̀̃̉̐;̡̙̤̪̬̀̇̋̑ ̘̙̠̀̆̎̚ ̀̅̉̓ ̖̀̃̌ ̖̙̀́̄̅̉̒ ̀B̀̈̐̔ừ̘̆̎̏̑t̘̟̀̃̉̊̍̏ ̀̉̋à́̈̋̐ ̀̉̊̒̒̔l̀̀̇̊̍̓̚ì̃g̀̈̐h̨̖̟̮̀̂̆̋̔t̀̇̌̍ ̀̇ǫ̗̠̠̀̆̈̉̑ǹ̇̌̍ ̙̣̀̀́̉̏̒t̀̀h̗̜̀̃̊̊̌̎è̙́̈̋̍̔ ̀̂h̗̀̂̇̈̏ì̙̝̣̉̑̓̓l̗̜̀̃̃̇̑l̞̀̈̏̑̕t̙̟̀̅̍̎̕̚ò̂̄p̀̂̋̍s̀̄̇̐ ̖̀̄̋̍h̗̀̅̋̐̓à̶̢̧̝̮̈̏̕l̀̂̊f̀̀̇̇-̀̄̄̉̓s̀̂̇̍è̘̈̏è̖̟̤̥̩̰̇̏ǹ̇̋̏ ̀̇̋̐̕h̀̉̏ì́̃̈̈ǹ̅̏̓t̀̇̈s̀̄̌ ̀̃̇̊̒ò̖̖̃̋̋̏f̛̀́̅̉̑ ̀́̃̈f̀̅è́̅̉à̃̅̌̓s̛̗̣̤̀́̃̄̌̎̑t̀̆̉ì̞̤̭̃̈̑̚ǹ̗̟̦̂̂̅̆̊̊̊̏g̗̀̅̊̓̓s̀̂ ̀̄̉̑̓̔ù̅̋ǹ́̊̎̒-̀́̄̈h̀́́̊̓̔à̀̈̊l̛̀̄̌̎̔l̢̛̖̣̀̉̋̕ò̆̊ẁ̉̐̚è̆̌̍d̜̥̦̭̀̀̂̈̑̔̕ ̀̇̍̓à̈̊ǹ̗́̆̋̑̔̕ḍ̴̛̪̬̀̅̊̌̑ ̨̙̜̤̭̀̀́̈̎̏ò̈l̀̈̎̏̐d̢̝̬̀̂̃̋̌̔.̨̝̝̤̪̀̅̇̊̓ ̀̈̌̐̓̕ ̛̗̤̮̮̰̀̃̉̊̏̐̒ ̀̄̇̏ ̀̉̐ ̀́̅̇̎

\$\endgroup\$
  • 5
    \$\begingroup\$ I don't think you're using the required normal distribution. It looks more like a uniform distribution between 0 and 100 (i.e. mean 50). \$\endgroup\$ – Martin Ender Sep 11 '15 at 13:22
  • \$\begingroup\$ argh, you're right \$\endgroup\$ – Timothy Groote Sep 11 '15 at 13:22
  • 3
    \$\begingroup\$ You also zalgoify punctuation, which is disallowed in the OP \$\endgroup\$ – DankMemes Sep 11 '15 at 20:50
  • \$\begingroup\$ why not use for String.fromCharCode(768+~~k) this: String.fromCharCode(768|k)? \$\endgroup\$ – Nina Scholz Sep 15 '15 at 8:50
3
\$\begingroup\$

Perl, 73 bytes

s!\w\K!$x=-140;$x+=rand for 1..300;(x x $x) =~ s/x/chr 768+rand 48/ger!ge

Input is taken as newline-separated strings.

If you want to ignore the warnings printed to STDERR, use the -C7 command-line flag.

This uses the same approximation for a normal distribution as the Moonscript solution.

\$\endgroup\$
  • \$\begingroup\$ I've cleaned up the formatting a bit. We prefer having the code be the first code block of the answer, not the invocation. \$\endgroup\$ – Mego Sep 20 '16 at 4:47
  • \$\begingroup\$ Since nobody said it yet, welcome to PPCG! \$\endgroup\$ – Erik the Outgolfer Sep 20 '16 at 14:09
2
\$\begingroup\$

Haskell, 223 bytes

import System.Random
import Data.Char
a!b=round$10+sqrt(-50*log a)*cos(2*pi*b::Double)
r=randomIO
m=mapM
z s=concat.zipWith(\c r->c:[x|x<-r,isAlpha c])s<$>(m(\_->(!)<$>r<*>r)s>>=m(\x->m(\_->randomRIO('\768','\815'))[1..x]))

(!) does a Box-Muller transform on a pair of numbers, z maps each letter into random normally distributed number x, which is then mapped into the range [1..x], in which all numbers are replaced by a uniformly random punctuation. The original characters are then appended to these lists.

Sample output:

T̢̨̮̝̘̖̗̣̟̝̞̘́̔̇̅̌̐̐̋̕ŗ̦̘̬̄y̩̦̯̞̍̂̑ ï̛̘̣̟̭̮̩̄̍̑̂̅̚t ȯ̖̤̞̎̓̔̏̕̕̚ń̢̦̖̟̠̜̯̒̀̏̑̕ļ̨̛̫̟̝̎̇̃̍̑̊̇ĩ̛̯̙̦̦̐̚n̮̪̮̞̞̈̄̔̀̚ȩ̨̜̟̬̟̫̩̦̌̂̆̋̏̄̏́!

\$\endgroup\$
2
\$\begingroup\$

Perl 6, 68 63 59 bytes

{S:g/./{chrs roll max(0,-140+sum rand xx 300),768..815}$//}

Try it online!

t̤̣̜̉̌̂̇̍h̢̙̦̩̉ȇ̡̡̢̛̞̠̔̑̃̊̑̓ ̗̩̜̎̒̑i̛̭̤̘̒c̛̤̮̔́̑̃̔̅̐̑̚hǫ̘̣̩̣̙̙̆̎̂̉̋̊̕r̨̦̯̋̀̊̀ ̥̙̉̓̃̇̑p̢̨̛̯̗̥̞̞̘̬̪̗̠̖̅̅̉̃́̀̐̉e̖̋r̒̐m̧̖̪̉̐ẻä̪̞ţ̯̠̦̖̍̍̋̅̊̀̕ḙ̡̡̙̐̓̌̉̌ŝ̢̧̝̃̉̀ ̡̮̘̤̙̤̘̋̃̂̋̊̐̀̏̋̐̐̒ą̛̞̥̦̘̌̊̋̂̂̒̆l̢̛̛̮̘̜̦̝̫̮̪̟̭̖̜̅̑̂̍̑̉ḷ̨̞̜̤̠̣̪̥̋̀̇̊̊̍̈ ̢̢̤̜̬̫̊̇̑̐̇̑̒̕Ḿ̢̭̫̘̟̟̤̮́̃̎Y̧̬̖̜̆̀̍̍̐̒̉̒ ̡̗̔̎̆̆̀́̎F̬̯̯̏Â̡̛̝̭̎̂̉̑C̡̦̄̑̓Ę̛̭̞̤̂̓̔̃̎̓̏ ̛̪̬̯̘́̐̚MÝ̛̝̫̥̖̓̏̑̀ ̘̤̄́̍F̬̯̠̩̞̊̃̓̔̕Ă̙̥̞̤̕C̪̓̆E̡̟̝̭̦̮̎̒̅́ ̭̈̋ḣ̢̛̫̗̩̩̣̭̋̎̐̃̄̈̉̓ ̦̘̖̃̉̔̂̆̃̍̅̕g̡̧̢̜̬̪̞̟̒̇̊́̃̋̚ǭ̫̣̩̙̆̏̏̌̑̀̕d̟̮̠̬̙̗̥̪̭̜̐̑̊̔̕̕ ̨̙̠̟̠̯̆̑̅̒̔ṋ̛̘̜̞̦̈̋̋̍̋̈ơ̡̧̗̟̟̩̙̔̏̀̈̀̇̇̆̎̕ ̨̛̦̎̀̕N̛̄̋Ò̢̡̙̦̓̑̒̂̆́ ̧̗̮̠̗̮̯̆̉̑̅N̛̤̤̒O̧̤̯̯̦̥̒̍̏̃̇̊̕Ő̜̩̙̂̀̎̕Ọ̝̗̆̉Ơ̢̦̫̭̪̐̚̚ ̨̢̞̊̉̑̍̎̆̒N̡̞̭̙̏̏̓̄̚ ̠̖̫̦̗̓̉́s̤̄̋t̨̞̫̣̭̏̔̀ở̜̘̝̉ṗ̧̬̗̥̫̤̗̣̄̋̒̎́̒ ̯́̃̕ṭ̮̖̟̥̗̤́̊̋̇̎ḩ̞̜̗̪̊̂̏e̢̞̬̟̟̠̗̎̌̐̏̔̒ ̥̠̞̉̌́̈́̈̏̍ä̡̨̩̩̯̦̐̂n̢̟̫̖̯̞̗̙̙̊̋̐̍̚*̢̘́̒̉̎̚g̛̗̬̐̂́̇̉̆̀̚l̨̢̦̪̬̤̤̂̀̇̉̂̍̒̚ȩ̧̢̖̘̠̓̐́̈̌s̘̯̘̒̉̆̒̄̈̇̕ ̡̧̛̬̠̣̮̅ă̗̮̖̜̥̟̮̋̅̉̍̅̕r̢̢̢̤̩̙̩̋̑̓̍̆̍̕̚e̡̛̙̗̅̄̄̒́̚ ̡̖̫̞̖̖̟̣̭̅̐̄̑̊̃̉̎ǹ̗̟̤̄ö̪̏̎t̡̛̫̥̗̫̠̜̪̏̒ ̡̡̢̜̮̭̇̒̋̑̏̃̓̕r̡̗̬̯̪̝̮̂̊̒̏̔̉̀̚e̢̧̗̯̞̭̘̝̐̓̈̔̊̋̉å̖̣̔̋l̡̛̛̬̮̟̝̪̯̆̊ ̡̪̩̐̒Z̡̦̗̝̞̜̠̊̇̓̆AḶ̒̇̇̅̓̈̃̂Ğ̮̯̭̮̘̞̙̣̐̐̉̇Ő̡̠̞̄ ̢̟̖̪̋́́̔̚̚Į̪̗̭̖̊Ș̢̬̤̜̥̟̌̅ ̨̢̜̥̪̠̦̦̦̘̟̯̯̋̒̓̍̈̇̕T̢̉̆̌̊̎̈̕Ȍ̧̢̫̬̄̉̀̇̍̍̌̚̕Ņ̥̩̝̟̀̈̀̇̆̏̕y̛̟̫̠̭̫̗̫̮̬̥̥̭̗̓̏̑̋̍̇̐̔̋̐̅ ̝̥̘̫̪̖̫̅̂̌́̎̀̚̚̕Ṭ̌H̦̫̖̟̥̣̔̚̕Ę̢̬̮̩̣̙̇̅ ̨̧̝̭̩̟̈̂̈̃̓̓̚P̩̞̭̠̝̗̂̓̒̋̄Ợ̙̬̜̮̄̑̊̏̒N̘̤̆̏̇Y̨̫̪̜̖̯̒̎̋̌̍̈̄̊ ̧̣̠̣̜̌̄̇̋̄̊̉̏H̛̠̮̣̝̩̖̋̑̍E ̡̢̙̘̥̬̗̯̄̌̔̂̀̆̇̔̑C̪̣̮̋̇̎O̧̨̩̖̠̓̓̉̚̚̕M̛̛̙̘̟̪̙̘̩̝̖̉́̀̂̏̇Ẻ̡̛̛̘̯̜̆̀̓̓̒S


Uses the, ahem, 'binomial approximation' to the normal...

Text from that bobince answer.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.