In this example we will show the method to create strong random numbers in Java.
Source Code
package com.beginner.examples;
import java.security.SecureRandom;
public class StrongRandomExample {
public static void main(String[] args){
SecureRandom random = new SecureRandom();
int num = 4;
while(num>0)
{
Integer randNum = random.nextInt(100);
System.out.println(randNum.toString());
num--;
}
}
}
Output:
4
49
16
3
References
Imported packages in Java documentation: