diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-02-09 19:38:26 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-02-09 19:39:13 +0100 |
| commit | d16656919753438a57a32f9ad6ba972c25d66b11 (patch) | |
| tree | e7b99259c2584d0c092b5044583571cce0a4918e /random_bigint | |
| parent | ece9b2e4c547c986fd9e2bb4b7d97287be5621fb (diff) | |
| download | zmodn-d16656919753438a57a32f9ad6ba972c25d66b11.tar.gz zmodn-d16656919753438a57a32f9ad6ba972c25d66b11.zip | |
Diffstat (limited to 'random_bigint')
| -rwxr-xr-x | random_bigint | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/random_bigint b/random_bigint new file mode 100755 index 0000000..250de64 --- /dev/null +++ b/random_bigint | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | #if 0 | ||
| 2 | |||
| 3 | cc=${CC:-g++} | ||
| 4 | bin="$(mktemp)" | ||
| 5 | |||
| 6 | if [ -z "$1" ] || [ -z "$2" ]; then | ||
| 7 | echo "Usage: $0 m n" | ||
| 8 | echo "Example: to generate 5 random 25-digits number use" | ||
| 9 | echo " $0 \\\"10000000000000000000000000\\\" 5" | ||
| 10 | exit 1 | ||
| 11 | fi | ||
| 12 | |||
| 13 | ${cc} -x c++ -std=c++20 -o "$bin" -g -O0 "$(realpath $0)" \ | ||
| 14 | -DMAX_RANDOM="$1" -DHOW_MANY="$2" | ||
| 15 | echo "Running $bin" | ||
| 16 | "$bin" | ||
| 17 | |||
| 18 | exit 0 | ||
| 19 | #endif | ||
| 20 | |||
| 21 | #include "bigint.h" | ||
| 22 | |||
| 23 | #include <iostream> | ||
| 24 | |||
| 25 | int main() { | ||
| 26 | // Read compile-time variables | ||
| 27 | int n = HOW_MANY; | ||
| 28 | BigInt<100> r(MAX_RANDOM); | ||
| 29 | |||
| 30 | for (int i = 0; i < n; i++) | ||
| 31 | std::cout << BigInt<100>::random(r) << std::endl; | ||
| 32 | |||
| 33 | return 0; | ||
| 34 | } | ||
