just wondering how you could produce a true random in, here is my code. Only thing is that everythime the random int is in the same order, first time 73 second time 10 and so on everytime i run my program
public class GuessingGame{
private RandomInt generator;
private int genNumber;
private IntValidator test;
private int uservalue;
private int guessCounter;
public GuessingGame(){
generator = new RandomInt(1);
genNumber = generator.next(99);
}
public void play(){
test = new IntValidator("Please guess a number between 1 and 99>"
uservalue = test.ask();
String correct = ("Congradulations, you guessed the correct answer,"
while(uservalue != genNumber){
if (uservalue > genNumber){
System.out.println("Your guess is too high,"
uservalue = test.ask();
guessCounter ++;
}
else{
System.out.println("Your guess is too low,"
guessCounter ++;
uservalue = test.ask();
}
}
guessCounter ++;
System.out.println(correct);
System.out.println(genNumber + " in " + guessCounter + " guesses"
genNumber = generator.next(99);
guessCounter = 0;
}
}
public class GuessingGame{
private RandomInt generator;
private int genNumber;
private IntValidator test;
private int uservalue;
private int guessCounter;
public GuessingGame(){
generator = new RandomInt(1);
genNumber = generator.next(99);
}
public void play(){
test = new IntValidator("Please guess a number between 1 and 99>"
uservalue = test.ask();
String correct = ("Congradulations, you guessed the correct answer,"
while(uservalue != genNumber){
if (uservalue > genNumber){
System.out.println("Your guess is too high,"
uservalue = test.ask();
guessCounter ++;
}
else{
System.out.println("Your guess is too low,"
guessCounter ++;
uservalue = test.ask();
}
}
guessCounter ++;
System.out.println(correct);
System.out.println(genNumber + " in " + guessCounter + " guesses"
genNumber = generator.next(99);
guessCounter = 0;
}
}