Description Of BigInteger: probablePrime(int bitLength, Random rnd)
The java.math.BigInteger.probablePrime(int bitLength, Random rnd) returns a positive BigInteger that is probably prime, with the specified bitLength. The probability that a BigInteger returned by this method is composite does not exceed 2-100BigInteger.probablePrime(int bitLength, Random rnd) method returns a BigInteger of bitLength bits that is probably prime
Code Example Java BigInteger
import java.math.BigInteger; import java.util.Random; public class BigIntegerExam { public static void main(String[] args) { int bitLength = 3; // create a random object Random rnd = new Random(); BigInteger bi = BigInteger.probablePrime(bitLength, rnd); System.out.println(bi); } }
ไม่มีความคิดเห็น :
แสดงความคิดเห็น