Random Alphabet

Make a random sequence of glyphs to serve as letters in an alphabet.

Run the code to draw a random line joining 4 points. Try numbers of points other than 4for example, 3:

SHOW/HIDE DETAILS

This draws a line through the points at coordinates {0,0}, {1,1}, and {2,0}:

In[1]:=
X
Out[1]=

You can turn on axes with AxesTrue in order to see the numeric coordinate positions:

In[2]:=
X
Out[2]=

Use RandomReal to draw a line with random coordinates.

This gives a random number between 0 and 1. Each time you run the code, you get a different number:

In[3]:=
X
Out[3]=

This gives a pair of numbers between 0 and 1. Each time you run the code, you get a different pair:

In[4]:=
X
Out[4]=

This gives four pairs of random numbers:

In[5]:=
X
Out[5]=

Use that code to draw a line with random coordinates:

In[6]:=
X
Out[6]=

Specify Thick to draw a thicker random line:

In[7]:=
X
Out[7]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Draw a random line joining between 3 and 6 points. Try ranges other than {3,6}for example, {2,3}:

SHOW/HIDE DETAILS

RandomReal gives random decimal numbers. For example, this gives a random decimal number between 3 and 6:

In[1]:=
X
Out[1]=

RandomInteger is like RandomReal, but gives only integers. This gives a random integer between 3 and 6:

In[2]:=
X
Out[2]=

Recall that this draws random lines with 4 points:

In[3]:=
X
Out[3]=

Replace 4 with RandomInteger[{3,6}] to draw random lines with between 3 and 6 points:

In[4]:=
X
Out[4]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Draw small, thick glyphs that could be characters in an alphabet. Try thicknesses other than 5:

SHOW/HIDE DETAILS

This draws graphics at the default size:

In[1]:=
X
Out[1]=

Make a small 30×30 pixel graphic by specifying ImageSize{30,30}:

In[2]:=
X
Out[2]=

Replace Thick with AbsoluteThickness[5] to get lines that are exactly 5 pixels thick:

In[3]:=
X
Out[3]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Make a list of 26 random glyphs, each made by joining between 3 and 6 points. Try other numbers of glyphs:

SHOW/HIDE DETAILS

Table makes lists of things. This uses Table to make a list of 26 random numbers:

In[1]:=
X
Out[1]=

Replace RandomReal[] with the glyph code from the previous step to make a list of 26 random glyphs:

In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Make rounded glyphs that look more like cursive writing using B-spline curves:

SHOW/HIDE DETAILS

This draws a line through several points:

In[1]:=
X
Out[1]=

If you replace Line with BSplineCurve, you get a smooth curve that approximates the path of the line:

In[2]:=
X
Out[2]=

Here are the line and the B-spline curve drawn in the same graphic so you can see how they correspond:

In[3]:=
X
Out[3]=

Replace Line with BSplineCurve in the glyph expression to get smooth glyphs that look more like cursive writing:

In[4]:=
X
Out[4]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Make rules that translate from the alphabet to glyphs:

SHOW/HIDE DETAILS

With a set of rules that specify which glyphs correspond to which letters, you can translate from words written with the normal alphabet to words written with glyphs. Each rule looks something like this:

In[1]:=
X

This gives the 26 capital letters in the alphabet. Give it the name letters:

In[2]:=
X
Out[2]=

This expression from the previous step gives 26 random glyphs. Give it the name glyphs:

In[3]:=
X
Out[3]=

Make rules from the letters to the glyphs using Thread. Thread changes a rule between lists to a list of rules between the elements of the lists:

In[4]:=
X
Out[4]=

This gives the translation rules from letters to glyphs:

In[5]:=
X
Out[5]=

We need one more rule to translate spaces to empty glyphs:

In[6]:=
X

Append that rule to the other rules to get a complete set of translation rules. Call it alphabet:

In[7]:=
X
Out[7]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Write out a sentence in the glyph alphabet. Try other sentences:

Note: make sure you run the code in the previous step first.

SHOW/HIDE DETAILS

The translation rules in alphabet only work on uppercase letters, so the first step in translating a sentence to glyphs is to use ToUpperCase to make the letters in the sentence upper case:

In[1]:=
X
Out[1]=

Then convert the uppercase text to a list of individual characters using Characters:

In[2]:=
X
Out[2]=

Now you can translate the letters to glyphs using the translation rules in alphabet.

Heres an example of using rules to replace parts of an expression. Every 0 in the expression to the left of /. is replaced with an a and every 1 is replaced with a Z:

In[3]:=
X
Out[3]=

Applying the alphabet rules to the characters in the text translates the text to glyphs:

In[4]:=
X
Out[4]=

Use Row to format the list of glyphs without commas and braces:

In[5]:=
X
Out[5]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Write the beginning of the US Constitution in the glyph alphabet:

SHOW/HIDE DETAILS

The alphabet rules are completely general and can be applied to any textfor example, the US Constitution.

This gives the first 200 characters of the text of the US Constitution:

In[1]:=
X
Out[1]=

This translates the text to glyphs:

In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Share ItMake a website that writes a text with a random alphabet:

SHOW/HIDE DETAILS

Deploy a form that writes text that you enter using a random alphabet:

In[1]:=
X
Out[1]=

Click the link in the output to visit the site.

Share the link by right-clicking it and choosing Copy Address. Paste the link into an email, tweet, or other message.

HIDE DETAILS
In[1]:=
X
Out[1]=