So I m new to programming and java, like really new. Anyway, I am trying to write a "guessing a number" game. I want to set this random number's range between 1000 to 10000 as you can see in the code. The gamer can guess an integer and if correct then game over, if-else then guesses again, also the game would tell the gamer if it's too small or too big. But I encountered a problem it says: "Incompatible operand types Random and int" I know what that means but how can I solve it tho?... Here is the code:
import java.util.Random;
import java.util.Scanner;
public class Game {
public static void main(String[] args) {
Random rnd = new Random((10000-1000)+1000);
Scanner scanner = new Scanner(System.in);
int guess = scanner.nextInt();
System.out.println("Please enter your number");
if(rnd = guess) {
System.out.println("You are right!");
}
else {
System.out.println("You are wrong try again!");
}
}
}