Randomizer

JollyJungle
1,031 views
undefined

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

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 + "!");
    }
}
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content