Randomizer
JollyJungle
3,799 views
Randomizer
I'm not sure why this doesn't work, please tell me in comments.
import java.util.Random;
public class Main {
public static void main (String[] args) {
Random rand = new Random();
int a = rand.nextInt(10) + 1;
String name = "Viewer";
if (a + 3 <= 10) {
System.out.println("Hello " + name + "!");
}
else {
System.out.println("Goodbye " + name + "!");
}
}
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.