Random r=new Random; int k=r.nextInt(max-min)+Min;不就是作变换嘛!
Random rand = new Random();
Random rand = new Random(); 1. int i = rand.netInt(MAX-MIN)+MIN; 2. ... 3. DateFormat df = new SimpleDateFormat(".00000"); float f = Float.parseFloat(df.format(1.111111111));
to:LoveXiaoShuang(): public class MathTest{ public static void main(String[] args){ for(int j = 1;j<10;j++){ int i = (int)(Math.random()*100+1); System.out.println(i); }
} } 这样就可以了
to:wb0622(波波): 谢谢
import java.util.Random; //产生一个随机数据;class rank { public static void main(String[] args) { //Random a= new Random; Random rand = new Random(); System.out.println(rand.nextInt()); } }
Random r=new Random;
int k=r.nextInt(max-min)+Min;不就是作变换嘛!
1. int i = rand.netInt(MAX-MIN)+MIN;
2. ...
3. DateFormat df = new SimpleDateFormat(".00000");
float f = Float.parseFloat(df.format(1.111111111));
public class MathTest{
public static void main(String[] args){
for(int j = 1;j<10;j++){
int i = (int)(Math.random()*100+1);
System.out.println(i);
}
}
}
这样就可以了
谢谢
//产生一个随机数据;class rank
{
public static void main(String[] args)
{
//Random a= new Random;
Random rand = new Random(); System.out.println(rand.nextInt());
}
}
2. 使用类Random,构造一个对象,再调用方法如 nextBoolean(), nextInt()等
产生随机字符
RandomCharacter累包含的两个重载的getRandomChar(char fromChar, char toChar)方法