5 added 61 characters in body

Moonscript - 118 117 112 110 10510596 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. The character 'Ì' in Latin 1So it is 11001100, andthe byte 204 followed by a random byte 128 to 175 are 10000000 to 10101111.

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


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

> moonc zalgo.moon;print luarequire'zalgo' zalgoio.lua "the string"


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

Moonscript - 118 117 112 110105 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. The character 'Ì' in Latin 1 is 11001100, and 128 to 175 are 10000000 to 10101111.

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


To use, pass the desired string as the first argument.

> moonc zalgo.moon; lua zalgo.lua "the string"
t̛̫̫̩̗̩̗̎̇̍h̛̟̜̠̜̉̂̋̀̚e̪̍̃̈̈̑̒̕ s̢̝̍̋̉́̅̊̚t̞̞̫̒̎̍ŗ̨̜̥̣̙̭̓̏̀ǐ̞̇̆n̡̨̜̟̪̖̫̣̎̚g̠̬̈̆̋̇


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 @.

Moonscript - 118 117 112 110 10596 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
4 added 288 characters in body

Moonscript - 118 117 112 110112105 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. The character 'Ì' in Latin 1 is 11001100, and 128 to 175 are 10000000 to 10101111.

r=math.random
b=-140)=>
b=b+r!for _=1,300
a=a@=@..a@.char(204,r127+r 128,17548)for _=1,b
a@


To use, pass the desired string as the first argument.

> moonc zalgo.moon; lua zalgo.lua "the string"
t̛̫̫̩̗̩̗̎̇̍h̛̟̜̠̜̉̂̋̀̚e̪̍̃̈̈̑̒̕ s̢̝̍̋̉́̅̊̚t̞̞̫̒̎̍ŗ̨̜̥̣̙̭̓̏̀ǐ̞̇̆n̡̨̜̟̪̖̫̣̎̚g̠̬̈̆̋̇


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 @.

Moonscript - 118 117112 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. The character 'Ì' in Latin 1 is 11001100, and 128 to 175 are 10000000 to 10101111.

r=math.random
b=-140
b=b+r!for _=1,300
a=a..a.char(204,r 128,175)for _=1,b
a


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

Moonscript - 118 117 112 110105 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. The character 'Ì' in Latin 1 is 11001100, and 128 to 175 are 10000000 to 10101111.

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


To use, pass the desired string as the first argument.

> moonc zalgo.moon; lua zalgo.lua "the string"
t̛̫̫̩̗̩̗̎̇̍h̛̟̜̠̜̉̂̋̀̚e̪̍̃̈̈̑̒̕ s̢̝̍̋̉́̅̊̚t̞̞̫̒̎̍ŗ̨̜̥̣̙̭̓̏̀ǐ̞̇̆n̡̨̜̟̪̖̫̣̎̚g̠̬̈̆̋̇


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 @.
3 edited body

Moonscript - 118 117117 112 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. The character 'Ì' in Latin 1 is 11001100, and 128 to 175 are 10000000 to 10101111.

r=math.random
b=-140
b=b+r!for _=1,300
a=a..stringa.char(204,r 128,175)for _=1,b
a


Edit: Turns out it's cheaper to use char code 204 instead of an embedded Latin 1 character.

• Turns out it's cheaper to use char code 204 instead of an embedded Latin 1 character.
• Can access string.char using a.char

Moonscript - 118117 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. The character 'Ì' in Latin 1 is 11001100, and 128 to 175 are 10000000 to 10101111.

r=math.random
b=-140
b=b+r!for _=1,300
a=a..string.char(204,r 128,175)for _=1,b
a


Edit: Turns out it's cheaper to use char code 204 instead of an embedded Latin 1 character.

Moonscript - 118 117 112 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. The character 'Ì' in Latin 1 is 11001100, and 128 to 175 are 10000000 to 10101111.

r=math.random