i am mking a program where the computer guesses your number. and it has to guess a random num. but how do i make the random line be lower or higher num than the perviously num guessed?
package compguse;
import java.util.*;
public class Compguse {
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
String a;
String b;
String c;
String ans;
String d;
int input =1;
System.out.println("do u have your number?");
a = scan.nextLine();
while (a.equalsIgnoreCase("yes"))
{
int ran = (int) Math.floor(Math.random()*100)+1;
System.out.println(" is" +ran +" your num?");
a = scan.nextLine();
if(a.equalsIgnoreCase("no"))
{
System.out.println("Was i too high or low?");
b = scan.nextLine();
if(b.equalsIgnoreCase("high"))
{
int ran1 = (int) Math.floor(Math.random() < (int) ran);
}
}
}
}