import java.util.Random;
class Run
{
public static void main(String args[])
{
int i;
Random d = new Random(3);
Random d1 = new Random(0);
for(i=0;i<10;i++)
{
System.out.println("Print Random value having seed 3 " + d.nextInt(1000));
System.out.println("Print Random value having seed 0 : "+d1.nextInt(1000));
}
}
}
output:
Print Random value having seed 3 734
Print Random value having seed 0 : 360
Print Random value having seed 3 660
Print Random value having seed 0 : 948
Print Random value having seed 3 210
Print Random value having seed 0 : 29
Print Random value having seed 3 581
Print Random value having seed 0 : 447
Print Random value having seed 3 128
Print Random value having seed 0 : 515
Print Random value having seed 3 202
Print Random value having seed 0 : 53
Print Random value having seed 3 549
Print Random value having seed 0 : 491
Print Random value having seed 3 564
Print Random value having seed 0 : 761
Print Random value having seed 3 459
Print Random value having seed 0 : 719
Print Random value having seed 3 961
Print Random value having seed 0 : 854
class Run
{
public static void main(String args[])
{
int i;
Random d = new Random(3);
Random d1 = new Random(0);
for(i=0;i<10;i++)
{
System.out.println("Print Random value having seed 3 " + d.nextInt(1000));
System.out.println("Print Random value having seed 0 : "+d1.nextInt(1000));
}
}
}
output:
Print Random value having seed 3 734
Print Random value having seed 0 : 360
Print Random value having seed 3 660
Print Random value having seed 0 : 948
Print Random value having seed 3 210
Print Random value having seed 0 : 29
Print Random value having seed 3 581
Print Random value having seed 0 : 447
Print Random value having seed 3 128
Print Random value having seed 0 : 515
Print Random value having seed 3 202
Print Random value having seed 0 : 53
Print Random value having seed 3 549
Print Random value having seed 0 : 491
Print Random value having seed 3 564
Print Random value having seed 0 : 761
Print Random value having seed 3 459
Print Random value having seed 0 : 719
Print Random value having seed 3 961
Print Random value having seed 0 : 854
No comments:
Post a Comment