Random words
in
Programming Questions
•
1 years ago
I made a program, but it not works fine.
I have a problem:
I want to have a random word that appears a second on the right or left side of the screen.
But know it appears between 100 and 500.
and there appear more word than one.
How can I fix this.
This is a piece of my code:
- void word () {
- float side;
- int links = (100);
- int rechts = (500);
- side = random (links, rechts); // left or right but now it is between 100 and 500 HOW can I fix this?
- fontA = loadFont("Arial-BoldMT-16.vlw");
- textFont(fontA, 16);
- fill (0);
- String[] words = {
- "smaak", "tafels", "friet", "print", "licht", "geval", "paard", "laars", "plots", "kapel"
- }; // random words
- int index = int(random(words.length)); // same as int(random(10))
- println(words[index]); // prints one of the six words // but now a few :(
- text(words[index], side, 300);
- }
1