# BigInt random numbers

Up a level : Algebra and Arithmetic
Previous page : RSA cryptosystem In this page you can generate BigInt random numbers in between two given values, a, b including the given values, and check if large numbers are prime.

• Generator 1  Generates a random big number between two numbers.
• Generator 2 Generates a random number with a selected number of decimal digits or bits. Can also be used to check if a number is a prime number.

Generator 1

It first calculates the difference c=b-a, then it splits the value c in groups of 10 digits, starting from the most significant figure. It will then loop through c in the following way:

1. Let the result be “”.
2. Get the most significant part not yet handled, say f.
3. Generate a random integer between 0 and f, inclusive, say r.
4.  If r=f, then set f to the next 10 digit part of c, else set f=10000000000. If so, use that f for all following part, except possibly the last where f=10^number of digits left.
5. Concatenate r to the result.
6. Repat from 3  until all parts of c is handled. Up a level : Algebra and Arithmetic
Previous page : RSA cryptosystem Last modified: Oct 29, 2023 @ 19:09