If I understand your question, you want a text layer to choose a DNA letter (i.e. G,C,T, and A.) and that is it? OK if so, then no prob,
So for your text layer that you want to have randomly choose a letter just add this script into the source text field.
seedRandom(Index, true); //I used the seed random so that your random letter wouldn't change at every frame. I used index as the seed so that layers that start on the same frame don't have the same value
V=random(0, 4.9); //chooses a random number with decimals between 0 and 4.9. If you just did 4 then with rounding 4 would almost never be chosen because it would have to pick exactly 4
R=Math.floor(V); //Rounds it down to a whole number
if (R = 1) { "G"
} else if (R = 2) { "C"
} else if (R = 3) { "T"
} else { "A"
} //This just assigns a letter value to each number output we created
Now as we know DNA only connects certain letter to other letters so If you wanted to have a Text layer that chose the correct match to the random Letter chosen then place a text layer directly under (very important!!!) the one you want it to pair with and put this expression in the source text field.
P=thisComp.layer(Index-1).text.sourceText; //Checks the source text of the layer directly above it
if (P = "C") { "G"
} else if (P = "G") { "C"
} else if (P = "A") { "T"
} else { "A"
} //whatever letter is chosen on the layer above this sets the value to its partner letter
As a note, I did this on a chromebook without any access to AE so was not able to test this. The expressions are fairly simple so I just pounded it out. I am sure however that I have some syntax errors somewhere and it may not work straight off, but if there are let me know and I will help find the mistakes if need be.
Doyle Lewis,
Location Assistant
ABC Studios