下面的代码编译得很好,但它们不会生成位数
ganerateNewRandom("aaaa", 3)
结果将是aaa435
。
下面的代码编译得很好,但它们不会生成位数
import java.util.*;
public class Student
{
private String studentId;
private String name;
private Random random;
public Student( String name)
{
studentId = "UnKnow";
this.name = name;
random = new Random();
}
public String ganerateNewRandom(String prefix, int number)
{
int index = random.nextInt(number);
return prefix + number + "";
}
}