本文整理汇总了C#中biz.ritter.javapi.nextInt方法的典型用法代码示例。如果您正苦于以下问题:C# biz.ritter.javapi.nextInt方法的具体用法?C# biz.ritter.javapi.nextInt怎么用?C# biz.ritter.javapi.nextInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类biz.ritter.javapi
的用法示例。
在下文中一共展示了biz.ritter.javapi.nextInt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: consBigInteger
/**
* A random number is generated until a probable prime number is found.
*
* @see BigInteger#BigInteger(int,int,Random)
* @see BigInteger#probablePrime(int,Random)
* @see #isProbablePrime(BigInteger, int)
*/
internal static BigInteger consBigInteger(int bitLength, int certainty, java.util.Random rnd)
{
// PRE: bitLength >= 2;
// For small numbers get a random prime from the prime table
if (bitLength <= 10) {
int[] rp = offsetPrimes[bitLength];
return BIprimes[rp[0] + rnd.nextInt(rp[1])];
}
int shiftCount = (-bitLength) & 31;
int last = (bitLength + 31) >> 5;
BigInteger n = new BigInteger(1, last, new int[last]);
last--;
do {// To fill the array with random integers
for (int i = 0; i < n.numberLength; i++) {
n.digits[i] = rnd.nextInt();
}
// To fix to the correct bitLength
n.digits[last] = (int)((long)n.digits[last] | (long)(0x80000000));
n.digits[last] = java.dotnet.lang.Operator.shiftRightUnsignet(n.digits[last], shiftCount);
// To create an odd number
n.digits[0] |= 1;
} while (!isProbablePrime(n, certainty));
return n;
}