I have something like this:
import java.util.Random;
public class gramatica {
public static void main(String[] args) {
String [] Vt = {"S","R","L"};
String [] Vn = {"a","b","c","d","e","f"};
String [] S = {
"aS","bS","cR","dL"
};
String[] R = {
"dL","e"
};
String []L = {
"fL","eL","d"
};
System.out.println(S[0]);
String random = (S[new Random().nextInt(S.length)]);
String chop = (S[new Random().nextInt(S.length)]);
System.out.println("S->"+random);
If, after making the random selection from S, and getting, for example "cR", I want to replace instead of "R" some random selection from String[] R, how should I go about that? Example: Look i start with S , then i get random from S and if i got cR i replace only R with random from R string array. S->cR->cdL (instead of R i put dL)