I'm trying to get Processing to randomly pick a document and print it from terminal, but so far I'm not sure how to do the first part: put filenames in an array and have Processing randomly pick filenames from the array. Any help would be appreciated!
String[] document = new String[3];// = loadStrings("/Users/saraswatikalwani/Desktop/Hello.txt");
int n = 1;
document[0] = "/Users/saraswatikalwani/Desktop/Hello.txt";
document[1] = "/Users/saraswatikalwani/Desktop/How.txt";
document[2] = "/Users/saraswatikalwani/Desktop/Bye.txt";
//String document = [];
//String []document = new String[3];
//int n = int(random(0,1));
//var document = [];
//int n = //randomnumber
//String choosen = document[n];// = random(document);
void setup() {
size(640, 360);
//document[0] = "/Users/saraswatikalwani/Desktop/Hello.txt";
// document[1] = "/Users/saraswatikalwani/Desktop/How.txt";
//document[2] = "/Users/saraswatikalwani/Desktop/Bye.txt";
}
void draw() {
}
void mousePressed() {
String[] params = {"lpr", "document[1]" };
exec(params);
}