Random Number Generator
Truly random integers in any range, drawn with a cryptographic RNG
Enter a valid minimum
Enter a valid maximum
Enter a count (1-200)
Truly random integers in any range, drawn with a cryptographic RNG
Enter a valid minimum
Enter a valid maximum
Enter a count (1-200)
Most "random" numbers on the web are not very random. They come from Math.random(), a fast but predictable generator fine for shuffling animations and not much else. This tool draws from crypto.getRandomValues() — the browser's cryptographic source, the same machinery that produces encryption keys — so the outputs are suitable for raffles, giveaways, sampling and games where fairness actually matters.
Set a minimum and maximum, choose how many integers you want (1–200), and decide whether repeats are allowed. With repeats allowed each draw is independent, like rolling a die. With "No repeats" it works like drawing names from a hat: every value in the range can appear at most once, provided the range is large enough.
A random 32-bit word is taken from the crypto source and mapped into your range. When you ask for many unique values from a small range, the generator shuffles the whole range instead — the Fisher–Yates method — which guarantees termination and uniform coverage. Result order is itself re-shuffled so the display does not leak the internal draw order.
| Setup | Use | Typical result |
|---|---|---|
| 1–6, one draw | Die roll | 4 |
| 1–100, one draw | Raffle winner | 73 |
| 1–49, six unique | Lottery-style pick | 5, 12, 18, 27, 33, 44 |
| 0–1, ten draws | Coin flips | 1,0,0,1,1,0,1,1,0,0 |
网上大多数「随机数」其实并不太随机——它们来自 Math.random(),速度快但可预测,做做界面动画还行。本工具改用 crypto.getRandomValues()——浏览器里与加密密钥同源的加密级随机源——输出适合抽奖、发放福利、抽样和任何在乎公平性的游戏场景。
设置最小值与最大值,选择要抽多少个整数(1–200),再决定是否允许重复。允许重复时,每次抽取相互独立,如同掷骰子;选择「不可重复」则像摸奖箱:区间内每个值最多出现一次,前提是区间足够大。
每次从加密源取一个 32 位随机字并映射到你的区间。当你要从小区间里取大量不重复值时,生成器会改为对整个区间做 Fisher–Yates 洗牌——既保证必然终止,也保证覆盖均匀。展示顺序还会再洗一次,避免泄露内部抽取顺序。
| 设置 | 用途 | 典型结果 |
|---|---|---|
| 1–6,抽 1 个 | 掷骰子 | 4 |
| 1–100,抽 1 个 | 抽奖中奖者 | 73 |
| 1–49,抽 6 个不重复 | 乐透式选号 | 5, 12, 18, 27, 33, 44 |
| 0–1,抽 10 个 | 抛硬币 | 1,0,0,1,1,0,1,1,0,0 |
They come from crypto.getRandomValues(), the browser's cryptographic random number generator — the same source browsers use for encryption keys. For picking raffle winners, game rolls or samples it is effectively unpredictable; no calculator can add more randomness than the source itself.
Yes — switch Duplicates to "No repeats". The range must contain at least as many integers as the count you request; the generator then works like drawing names from a hat. This is the standard way to run a giveaway or pick lottery-style samples.
From −1,000,000,000 to 1,000,000,000, and up to 200 numbers per draw. For most uses — dice, raffles, sampling, game mechanics — that is far beyond what you will ever need.
Last reviewed: October 5, 2026 · How we calculate · Sources: Web Crypto API (crypto.getRandomValues)
最近复核:2026 年 10 月 5 日 · 我们的计算方法 · 来源:Web Crypto API (crypto.getRandomValues)