Replace words with different synonyms and print each combination in a text file

Hello,

An example for you:

String words1[] = {"Wie", "Und", "froh", "ausgelassen", "bin", "ich", "daß"};

String s = "Wie froh bin ich, daß ich weg bin! Bester Freund, was ist das Herz des Menschen! Dich zu verlassen, den ich so liebe, von dem ich unzertrennlich war, und froh zu sein!";

void setup() 
  {
  for(int i=0; i<words1.length; i++)
    {
    print(words1[i] + " ");
    }
    
    int r1 = int( random(words1.length));
    int r2 = int( random(words1.length));
    s = s.replaceAll( words1[r1], words1[r2] );
    
    println(r1, r2, words1[r1], words1[r2]);
    println(s);
    
  noLoop();  
  }

You can also do this with:
https://processing.org/reference/StringList.html

:)