🔍

首页Home › 数学工具Math

🔐 生成随机质数Generate Random Prime Numbers

在范围内随机生成质数(确定性 Miller-Rabin)。本地处理。可设置「个数」、「下限」、「上限」、「种子」、「不重复」。Random primes in a range (deterministic Miller-Rabin). Processed locally. Settings: How many, Min, Max, Seed, Unique.

使用说明与常见问题How-to & FAQ

「生成随机质数」是什么?What is the Generate Random Prime Numbers tool?

在范围内随机生成质数(确定性 Miller-Rabin)。本地处理。可设置「个数」、「下限」、「上限」、「种子」、「不重复」。Random primes in a range (deterministic Miller-Rabin). Processed locally. Settings: How many, Min, Max, Seed, Unique.

如何使用「生成随机质数」?How do I use the Generate Random Prime Numbers tool?

在「生成随机质数」中,按需设置「个数」、「下限」、「上限」、「种子」,结果会实时显示在下方,点击「复制结果」即可复制。In the Generate Random Prime Numbers: Adjust "How many", "Min", "Max", "Seed"; the result appears below instantly — click "Copy result" to copy it.

能生成多大的质数?How large can the primes be?

上下限可在 2 到 1,000,000,000 之间,一次最多 100 个。每个候选数都用确定性的 Miller–Rabin 检验,在这个范围内判断准确;范围内质数不够时会提示。Min and Max can be anywhere from 2 to 1,000,000,000, with up to 100 primes at a time. Each candidate is checked with a deterministic Miller–Rabin test, which is exact in this range; you get a message if the range has too few primes.

生成的数一定是质数吗?Is every number really prime?

是的。每个候选数先用 37 以内的质数试除,再用确定性的 Miller–Rabin 测试(以 2 到 37 的全部 12 个质数为底,按大整数 BigInt 运算)。这组底数对 3.3×10^24 以下的所有整数都给出确定的结论,而本页上限是 10 亿,所以输出的每个数都是真正的质数(例如 1681 = 41² 和 1927 = 41 × 47 不会出现)。Yes. Each candidate is trial-divided by the primes up to 37 and then checked with a deterministic Miller–Rabin test using all 12 prime bases from 2 to 37 in big-integer arithmetic (BigInt). That base set is proven correct for every integer below 3.3×10^24, and this page stops at one billion, so every number shown is a true prime (composites such as 1681 = 41² and 1927 = 41 × 47 never appear).

范围和随机数怎么取?How are the range and the random numbers handled?

下限和上限都是 2 到 1,000,000,000 之间的整数,在这个范围内 JavaScript 数字能精确表示每个整数;候选数从范围内均匀抽取(两端都包含)。填了种子时结果可以复现,留空则使用浏览器的安全随机数。Min and Max are whole numbers from 2 to 1,000,000,000, a range where JavaScript numbers represent every integer exactly; candidates are drawn uniformly from the range, both ends included. With a seed the result is reproducible; leave it blank to use the browser's secure random numbers.

输入和输出是什么样的?What does the input and output look like?

例如在「生成随机质数」中把「个数」设为 3,「下限」设为 2,「上限」设为 20,「种子」设为 1,「不重复」设为 勾选,「排序」设为 勾选,输出为:7 ⏎ 13 ⏎ 17(⏎ 表示换行)。For example, in the Generate Random Prime Numbers with "How many" set to 3, "Min" set to 2, "Max" set to 20, "Seed" set to 1, "Unique" set to on, "Sort" set to on, the output is: 7 ⏎ 13 ⏎ 17 (⏎ marks a line break).

有哪些选项可以调整?What options can I adjust?

「生成随机质数」的设置:「个数」默认 5;「下限」默认 2;「上限」默认 100;「种子」默认 1;可勾选:「不重复」(默认勾选)、「排序」。每次生成结果都按当前设置处理。Settings in the Generate Random Prime Numbers — "How many" default 5; "Min" default 2; "Max" default 100; "Seed" default 1; tick boxes: "Unique" (on by default), "Sort". The result always uses the current settings.

「生成随机质数」免费吗?需要注册吗?Is the Generate Random Prime Numbers free? Do I need an account?

「生成随机质数」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Generate Random Prime Numbers is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.

相关工具Related tools

🔐 随机质数生成器Random Prime Generator? 质数判定Number Primality Test⃗ 生成随机向量Generate Random Vector³ 生成立方数列Generate Sequence of Cubes² 生成平方数列Generate Sequence of Squares𝕀 生成单位矩阵Generate Unit Matrix🔁 线性递推计算器Linear Recurrence Calculator🎯 挑一个数Pick a Number🎲 随机数字矩阵Random Number Matrix🔀 打乱数字各位Shuffle Digits🔢 排序数字各位Sort Digits📝 分数百分比计算器Marks Percentage Calculator

← 全部工具All tools