forked from deepdalsania/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRandom_Demo.java
More file actions
39 lines (27 loc) · 939 Bytes
/
Random_Demo.java
File metadata and controls
39 lines (27 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package utilpck;
import java.util.Random;
public class Random_Demo {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Random r = new Random();
System.out.println("<< 10 Random Number between 0 to 10 >>");
System.out.print("[");
for(int i = 0; i < 10; i++)
{
System.out.print(r.nextInt(10)+" , ");
}
System.out.println("]");
System.out.println("Integer : "+r.nextInt(10));
System.out.println("Boolean : "+r.nextBoolean());
System.out.println("Long : "+r.nextLong());
System.out.println("Double : "+r.nextDouble());
System.out.println("Float :"+r.nextFloat());
System.out.println("Gaussian : "+r.nextGaussian());
// System.out.println(r.nextInt());
/*long seed = 95;
random.setSeed(seed);*/
}
}