🔍

首页Home › 编码与加密Encoding & Crypto

🎲 随机二进制数生成器(指定位数、不重复、可设种子)Generate Random Binary Values

一次生成最多 10000 个随机二进制数(全部加起来最多 200 万位):可设定每个数的位数(1–1024 位),可要求首位为 1(保证正好是 N 位)、互不重复,并可选择换行、空格或逗号分隔,加 0b 前缀或在括号里显示十进制值。默认使用浏览器的安全随机数(crypto.getRandomValues);填写“种子”后,相同设置每次都会得到相同结果,便于出题和复现测试数据。全部在浏览器本地完成。Generate up to 10,000 random binary numbers at once (total at most 2,000,000 bits across all values). Choose the bit length (1–1024), require the first bit to be 1 so every value is exactly N bits long, make all values different, and separate them with new lines, spaces or commas, with an optional 0b prefix or the decimal value in brackets. By default the secure random generator built into the browser (crypto.getRandomValues) is used; enter a seed and the same settings always give the same result, which is handy for exercises and reproducible test data. Everything runs in your browser.

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

「随机二进制数生成器(指定位数、不重复、可设种子)」是什么?What is the Generate Random Binary Values tool?

一次生成最多 10000 个随机二进制数(全部加起来最多 200 万位):可设定每个数的位数(1–1024 位),可要求首位为 1(保证正好是 N 位)、互不重复,并可选择换行、空格或逗号分隔,加 0b 前缀或在括号里显示十进制值。默认使用浏览器的安全随机数(crypto.getRandomValues);填写“种子”后,相同设置每次都会得到相同结果,便于出题和复现测试数据。全部在浏览器本地完成。Generate up to 10,000 random binary numbers at once (total at most 2,000,000 bits across all values). Choose the bit length (1–1024), require the first bit to be 1 so every value is exactly N bits long, make all values different, and separate them with new lines, spaces or commas, with an optional 0b prefix or the decimal value in brackets. By default the secure random generator built into the browser (crypto.getRandomValues) is used; enter a seed and the same settings always give the same result, which is handy for exercises and reproducible test data. Everything runs in your browser.

如何使用「随机二进制数生成器(指定位数、不重复、可设种子)」?How do I use the Generate Random Binary Values tool?

在「随机二进制数生成器(指定位数、不重复、可设种子)」中,按需设置「数量」、「位数」、「种子(留空 = 真随机)」、「分隔方式」等选项,然后点击「重新生成」、「复制」、「下载 TXT」按钮即可。In the Generate Random Binary Values: Set "How many", "Bits per value", "Seed (blank = truly random)", "Separator", then click "Generate again", "Copy", "Download TXT".

这些随机数安全吗?Are these numbers secure?

不填种子时使用浏览器的 crypto.getRandomValues,属于密码学安全的随机数,可以用于生成测试密钥等;填写种子后改用可复现的伪随机算法(mulberry32),同一个种子总会得到同样的结果,适合出题、测试和演示,但不要用于安全用途。With no seed the tool uses crypto.getRandomValues from the browser, a cryptographically secure source suitable for things like test keys. With a seed it switches to a reproducible pseudo-random generator (mulberry32): the same seed always gives the same output, which suits exercises, tests and demos, but should not be used for security.

“首位必须是 1”有什么用?What does "First bit must be 1" do?

普通随机时,有一半的数以 0 开头,去掉前导 0 后就不足 N 位。勾选后每个数的首位固定为 1,其余位随机,保证每个值都正好是 N 位二进制数(例如 8 位时范围是 128–255)。Normally half of the values start with 0, so without leading zeros they would be shorter than N bits. With this option the first bit is always 1 and the rest are random, so every value is a true N-bit number (for 8 bits the range is 128–255).

“互不重复”有数量限制吗?Is there a limit for "All different"?

有。N 位二进制数一共只有 2 的 N 次方个(首位为 1 时减半),要求的数量超过这个上限会提示错误,例如 4 位最多 16 个。数量接近上限时,工具会从全部可能值中随机抽取,结果均匀且不会卡住。另外,数量 × 位数不能超过 200 万位(例如 10000 × 201 会提示结果太大)。Yes. There are only 2^N different N-bit values (half that when the first bit must be 1), so asking for more shows an error — for example at most 16 values of 4 bits. When the count is close to the limit, the tool shuffles all possible values and picks from them, so the result stays uniform and fast. Separately, count × bits cannot exceed 2,000,000 bits in total (for example 10000 × 201 is refused as too large).

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

「随机二进制数生成器(指定位数、不重复、可设种子)」的设置:「数量」默认 10,范围 1–10000;「位数」默认 8,范围 1–1024;「种子(留空 = 真随机)」可留空;「分隔方式」可选 每行一个、空格分隔、逗号分隔(默认 每行一个);可勾选:「首位必须是 1(正好 N 位)」、「互不重复」、「加 0b 前缀」、「显示十进制值」。改动任一选项后结果会按新设置重新生成。Settings in the Generate Random Binary Values — "How many" default 10, range 1–10000; "Bits per value" default 8, range 1–1024; "Seed (blank = truly random)" optional; "Separator": One per line, Spaces, Commas (default One per line); tick boxes: "First bit must be 1 (exactly N bits)", "All different", "Add 0b prefix", "Show decimal value". Changing any option regenerates the result with the new setting.

编码和加密有什么区别?Is encoding the same as encryption?

编码(如 Base64、URL 编码)可直接还原,不提供保密性;加密需要密钥。「随机二进制数生成器(指定位数、不重复、可设种子)」的处理全部在本地完成。No. Encoding (Base64, URL…) is reversible by anyone; encryption needs a key. The Generate Random Binary Values works fully offline in your browser.

「随机二进制数生成器(指定位数、不重复、可设种子)」免费吗?需要注册吗?Is the Generate Random Binary Values free? Do I need an account?

「随机二进制数生成器(指定位数、不重复、可设种子)」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Generate Random Binary Values 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

➕ 二进制加法计算器(多个二进制数求和)Add Binary Numbers🖼️ 二进制转图片(0 和 1 画成像素图)Convert Binary to Image🧬 Unicode 转 Base64Convert Unicode to Base6401 Unicode 转二进制Convert Unicode to Binary#️⃣ Unicode 转十六进制Convert Unicode to Hex8️⃣ Unicode 转八进制Convert Unicode to Octal🔤 Unicode 转 UTF-16Convert Unicode to UTF-16🔗 Unicode 转 Data URLConvert Unicode to Data URL🔤 Unicode 转 UTF-32Convert Unicode to UTF-32🔗 Unicode URL 编码URL Encode Unicode🔢 任意进制转 UTF-8 文本Convert Arbitrary Base to UTF-8🧬 Base64 转 UTF-8 文本Convert Base64 to UTF-8

← 全部工具All tools