Here you can find the source of getRandomBigInteger(int bits)
Parameter | Description |
---|---|
bits | number of bits to generate |
public static BigInteger getRandomBigInteger(int bits)
//package com.java2s; //License from project: Apache License import java.math.BigInteger; import java.util.Random; public class Main { /**//from w w w . java2 s. c o m * Creates a random BigInteger greater than 0 with the specified number of bits. * * @param bits number of bits to generate * @return random BigInteger */ public static BigInteger getRandomBigInteger(int bits) { return new BigInteger(bits, new Random()); } }