User Rating 0.0 โ˜…โ˜…โ˜…โ˜…โ˜…
Total Usage 0 times
Exact length of each integer (1โ€“10,000)
Presets:

  
Is this tool helpful?

Your feedback helps us improve.

โ˜… โ˜… โ˜… โ˜… โ˜…

About

Standard pseudorandom number generators in most languages produce values limited to 264 or roughly 18.4 quintillion. Applications in cryptography, Monte Carlo simulation, and distributed systems routinely require integers with hundreds or thousands of digits. Generating these naively - by concatenating small randoms - introduces modular bias that compromises uniformity. This tool uses the browser's crypto.getRandomValues() CSPRNG to produce byte arrays, then converts them to decimal strings of the exact requested length. For range-constrained generation between arbitrary min and max, it applies rejection sampling to guarantee a perfectly uniform distribution across the interval.

Failure to use a CSPRNG for key material or nonce generation can result in predictable outputs exploitable by attackers. Even non-security contexts suffer: biased sampling in simulations produces skewed statistics. This generator supports lengths up to 10,000 digits and batch sizes up to 10,000 with optional uniqueness enforcement. Note: uniqueness checking at extreme lengths (> 5,000 digits) with large batches may increase memory usage. The tool approximates true uniform distribution; negligible bias from byte-to-decimal conversion is on the order of 1 part in 2128.

big integer generator large number generator random big number arbitrary precision integer CSPRNG generator bigint random

Formulas

A cryptographically secure random integer with exactly d decimal digits is produced by first generating a byte array of length n = d2 + 1 from the CSPRNG, then converting each byte pair to a two-digit decimal. The first digit is forced to be non-zero by rejection-resampling. For range-constrained generation:

range = max โˆ’ min + 1
result = min + (R mod range)

where R is a uniformly random integer with enough bits to cover range. To eliminate modular bias, rejection sampling discards values where R โ‰ฅ range ร— 2krange (floor), with k being the bit length of R. The rejection probability is at most 12, so expected iterations converge rapidly.

Where d = number of decimal digits requested, n = byte array length, R = raw random BigInt, min and max = user-specified range bounds, k = bit length of the sampled value.

Reference Data

Bit LengthApprox. Decimal DigitsCommon Use CaseExample Standard
12839UUIDs, Session TokensRFC 4122
25678AES-256 KeysNIST SP 800-38A
512155HMAC Keys, Hash SeedsFIPS 198-1
1024309RSA Keys (legacy)PKCS #1 (deprecated)
2048617RSA Keys (standard)NIST SP 800-57
3072925RSA Keys (128-bit security)NIST SP 800-57
40961,234RSA Keys (high security)PKCS #1 v2.2
81922,467Post-quantum researchExperimental
153604,622256-bit equivalent RSANIST SP 800-57
327689,865Extreme precision mathResearch / HPC
Conversion: digits ≈ bits ร— log10(2) ≈ bits ร— 0.30103
QuantityTypical Time (1000 digits)Memory Est.Notes
1< 1 ms< 1 KBInstant
100< 10 msหœ 100 KBInstant
1,000หœ 50 msหœ 1 MBFast
10,000หœ 500 msหœ 10 MBProgress bar shown

Frequently Asked Questions

When generating a random integer between min and max, a naive modulo operation introduces bias because 2k is rarely an exact multiple of the range. This tool uses rejection sampling: it generates a random value R with enough bits to exceed the range, then discards values that fall in the biased tail (where R โ‰ฅ floor(2k / range) ร— range). The expected number of rejections is less than 1, so performance impact is negligible.
The tool generates integers with up to 10,000 decimal digits. This corresponds to approximately 33,219 bits (since bits โ‰ˆ digits รท 0.30103). This far exceeds current RSA key sizes and is suitable for research, mathematical exploration, and stress-testing parsers.
Yes. The tool uses the Web Crypto API's crypto.getRandomValues(), which sources entropy from the operating system's CSPRNG (e.g., /dev/urandom on Linux, CryptGenRandom on Windows). This meets NIST SP 800-90A requirements. The only caveat: the byte-to-decimal conversion introduces theoretical bias on the order of 1 part in 2128, which is negligible for all practical purposes.
Uniqueness is enforced via a Set of string keys. For 10,000 integers each with 10,000 digits, this requires approximately 100 MB of memory. Most modern browsers handle this, but low-memory devices may struggle. The probability of a random collision among 10,000 integers with 100+ digits is astronomically small (approximately 10โˆ’193 for 100-digit numbers), so uniqueness checking is rarely necessary at large digit counts.
When generating an integer with exactly d digits, the first digit must be in the range [1,9]. The tool generates a random byte, takes it modulo 9, adds 1, and uses rejection sampling on bytes โ‰ฅ 252 (since 252 = 9 ร— 28) to eliminate bias. The remaining dโˆ’1 digits are generated uniformly from [0,9].
This tool generates random integers, not primes. However, prime candidates for RSA key generation are typically odd random integers of a specific bit length, which you can approximate by generating an odd big integer here. Actual primality testing (Miller-Rabin, Lucas) is a separate computational step not included in this generator.