生成随机数,bound报错
```java
package txet;
import java.util.Random;
import java.util.Scanner;
public class text4_guess {
public static void main(String[] args) {
//生成随机数
Random r=new Random();
// int bound;
int number=r.nextInt( bound :100)+1;//生成1-100之间的随机数
System.out.println(number);//打印随机数
//猜随机数
int count=0;//计算猜的个数
Scanner sc=new Scanner(System.in);
while(true) {
System.out.println("请输入你要猜的数:");
int number1=sc.nextInt();
count++;
//保底,猜中三次,提示猜中了
if(count==3) {
System.out.println("猜中了");
break;
}
if(number1<number) {
System.out.println("小了");
}else if(number1>number) {
System.out.println("大了");
}
else {
System.out.println("猜中了");
break;
}
}
}
}
其后提示
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/821437477176153.png "#left")
改了之后又提示
![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/022387477176158.png "#left")
```