在线免费随机数生成器
一键在任意范围内生成随机数。
A random number generator picks whole numbers with no predictable pattern — every number in the range has an equal chance of being selected. This tool uses JavaScript's Math.random(), which is fast and statistically fine for games, raffles, classroom activities, and decision-making, though not a cryptographically secure source.
Common uses for random numbers
- Raffles and giveaways: number each entry and generate a random winner
- Games and dice: simulate dice rolls or generate random outcomes
- Statistics and sampling: pick random items from a list for unbiased selection
- Decision-making: choose between options by assigning each a number
- Random PINs: generate a number within a specific range
What this tool doesn't do
Count is capped at 20 numbers per generation, there's no decimal-number mode, and results are whole integers only. For a security-sensitive use case, reach for the Password Generator instead, which uses the cryptographically secure crypto.getRandomValues() API.
How the 随机数生成器 works
在「最小值」字段输入最小值,在「最大值」字段输入最大值。
在「数量」字段输入你想生成的随机数个数(1–20)。
如果每个数字只应出现一次,勾选「无重复」(需要范围 ≥ 数量),和/或勾选「排序结果」以升序排列。
点击「生成」立即生成随机数。再次点击可获得新一组。
Tips & tricks
- 没有小数模式——工具始终生成最小值和最大值之间的整数。
- 数量每次生成上限为 20 个——如需更大批量,请多次生成。
- 使用 Math.random(),而非加密安全的 API——生成密码或密钥请使用专用工具。
Frequently Asked Questions
这些随机数真的是随机的吗?
数字使用 JavaScript 的 Math.random() 生成,这是一种快速的伪随机生成器,对游戏、抽奖和课堂选人来说完全够用。它不是加密安全的来源,因此不要用于安全密钥或任何攻击者可预测性很重要的场景。
我可以为彩票生成无重复的随机数吗?
可以。启用「无重复」并设置范围。对于 6/49 彩票,设置最小值=1,最大值=49,数量=6,无重复。每次生成都会给出范围内的唯一数字。
我可以生成随机小数吗?
不可以——没有小数模式。工具始终生成最小值和最大值之间的整数。
我一次最多能生成多少个数字?
数量字段每次生成上限为 20 个数字。如需更大批量,可多次生成并合并结果,或使用电子表格公式进行批量生成。
我可以用它生成随机密码吗?
如果是数字 PIN 码,可以。如需带符号的完整字母数字密码,请使用专门的密码生成器工具,该工具还使用加密安全的 Web Crypto API,而非 Math.random()。
Is my data safe when using the 随机数生成器?
Completely safe. The 随机数生成器 processes everything locally in your browser. No input data, results, or usage information is ever transmitted to or stored on any server.
Are the results from the 随机数生成器 truly random?
Yes. The 随机数生成器 uses your browser's standard random number generator (JavaScript's Math.random()), which is suitable for games, decisions, and everyday randomness. It is not a cryptographically secure generator — for security-sensitive use cases like generating passwords or cryptographic keys, use a tool built specifically for that purpose.
Can I customise what the 随机数生成器 generates?
Yes. Where customisation options are available, you can add your own items, set numeric ranges, or adjust parameters before generating. Default settings are designed for the most common use case so you can get an instant result without any configuration.