how to create a block of text from from 45 sentences stored in an array.
in
Programming Questions
•
1 year ago
Hi im a reall newbie and am trying to use processing to build a "essay" from 45 sentences that are stored in an array.
I have so far built the array containing the ssentences and can call one to be displyed at random, however on running the program i would like it to call all the sentences in a random order each time it is run.
I would like these sentences to be displayed as one block of text, there will be no punctuation between each sentence just a single character space. with the text wrapping so it would appear something like this:
here is a random sentence Today is the worst wehather i could imagine Somehow
i cant believe it was there at all Looking at alphabets makes me wonder Driving a
fast car was all he could do Despite everything there was no choice for him to think
eventually i would it so that each time it is run the block of text could be exported as a A3 pdf and after each export that would be pressing a key would genertae the sentences again in a rando order.
i guess that it requires some kind of loop function? to call each sentence and display it and would like it so that it does not duplicate any of the sentences in each text block.
any help is greatly appreciated, here is my code so far.
I have so far built the array containing the ssentences and can call one to be displyed at random, however on running the program i would like it to call all the sentences in a random order each time it is run.
I would like these sentences to be displayed as one block of text, there will be no punctuation between each sentence just a single character space. with the text wrapping so it would appear something like this:
here is a random sentence Today is the worst wehather i could imagine Somehow
i cant believe it was there at all Looking at alphabets makes me wonder Driving a
fast car was all he could do Despite everything there was no choice for him to think
eventually i would it so that each time it is run the block of text could be exported as a A3 pdf and after each export that would be pressing a key would genertae the sentences again in a rando order.
i guess that it requires some kind of loop function? to call each sentence and display it and would like it so that it does not duplicate any of the sentences in each text block.
any help is greatly appreciated, here is my code so far.
- void setup(){
size(600, 400);
background(0);
fill(255);
//Array
String[] sentence = {"sentence 1", "sentence2", "sentence3", "sentence 4", "sentence 5"};
int n = int(random(5));
text(sentence[n], 30, 30);
}
1