package MyMath;
import java.util.Random;
//生成随机数  调用的是系统的方法
public class random {
public static void main(String args[])
{
Random random=new Random(5);
for(int i=0;i<10;i++)
{
System.out.println(random.nextInt());
}
}
}
  引用java 类库的实现方法
  下面自己写随机,,了解一下种子数,,其实对同一个种子生成的随机数是相同的,,但是种子数是不对更新的
package MyMath;
public class random1 {
public static void main(String args[])
{
double []r=new double[2];
r[0]=5.0;
for(int i=0;i<10;i++)
{
System.out.println(rand1(r));
}
}
public static double rand1(double []r)
{
double temp1,temp2,temp3,p,base;
base=256.0;
int  a=17,b=139;
temp1=r[0]*17+139;
temp2=(int)(temp1/256);
temp3=temp1-temp2*base;
r[0]=temp3;
p=temp3/256;
return p;
//基本思想 是   递推法  r[i]=mod(a*r[i-1],base);  随机数 p=r[i/base;
//这个随机数 确实是随机的  但是缺陷是它并不符合 正态分布  种子的选取会影响后来的分布的
}
}