🔀 二进制位随机打乱(洗牌,保持 1 的个数)Shuffle Binary Bits
把每个二进制数的各个位随机打乱顺序:位数和 1 的个数保持不变,只是位置被重新排列。可以填写种子让结果可复现,也可以让所有数使用同一种打乱方式(同一个置换),并显示每一位移到了哪里,方便按同样的置换还原。适合生成测试数据、出题、学习置换和简单的位混淆,数据在本地处理。Shuffle the bits of each binary number into a random order. The length and the number of 1s stay the same; only the positions change. Enter a seed for a reproducible result, use the same shuffle (one permutation) for every value, and show where each bit moved so the same permutation can be undone. Handy for test data, exercises, learning about permutations and simple bit scrambling. Processed locally.
使用说明与常见问题How-to & FAQ
「二进制位随机打乱(洗牌,保持 1 的个数)」是什么?What is the Shuffle Binary Bits tool?
把每个二进制数的各个位随机打乱顺序:位数和 1 的个数保持不变,只是位置被重新排列。可以填写种子让结果可复现,也可以让所有数使用同一种打乱方式(同一个置换),并显示每一位移到了哪里,方便按同样的置换还原。适合生成测试数据、出题、学习置换和简单的位混淆,数据在本地处理。Shuffle the bits of each binary number into a random order. The length and the number of 1s stay the same; only the positions change. Enter a seed for a reproducible result, use the same shuffle (one permutation) for every value, and show where each bit moved so the same permutation can be undone. Handy for test data, exercises, learning about permutations and simple bit scrambling. Processed locally.
如何使用「二进制位随机打乱(洗牌,保持 1 的个数)」?How do I use the Shuffle Binary Bits tool?
在「二进制位随机打乱(洗牌,保持 1 的个数)」中,把内容粘贴或输入到上方输入框,按需设置「种子(留空 = 随机)」,结果会实时显示在下方,点击「复制结果」即可复制。In the Shuffle Binary Bits: Paste or type into the input box, adjust "Seed (blank = random)"; the result appears below instantly — click "Copy result" to copy it.
怎样输入多个值?How do I enter several values?
每行一个,或用空格、逗号、分号分隔;每个值单独处理,原来的换行和分隔符保持不变。可以带 0b 前缀(结果也会保留),数中间的下划线会被忽略(如 1010_1100)。Put one value per line or separate them with spaces, commas or semicolons; each value is handled on its own and the original lines and separators are kept. A 0b prefix is fine (and kept in the result), and underscores inside a value are ignored (1010_1100).
打乱后会改变什么?What changes after shuffling?
只有位的顺序会变:位数不变,1 的个数(汉明重量)也不变,例如 10110000 打乱后仍是 8 位、有 3 个 1。所以全 0 或全 1 的数打乱后不变。数值一般会变,十进制结果不再相同。Only the order of the bits changes: the length and the number of 1s (the Hamming weight) stay the same — 10110000 is still 8 bits with three 1s afterwards. A value of all 0s or all 1s therefore stays the same. The numeric value usually changes.
怎样得到可复现的结果、怎样还原?How do I get a repeatable result, or undo it?
填写任意文字作为种子,相同的输入和设置每次都会得到相同的结果;不填种子时使用浏览器的安全随机数。勾选“显示置换”会列出结果的每一位来自原数的第几位,按这个对应关系把位放回原处即可还原;勾选“所有数用同一种打乱方式”时,所有等长的数使用同一个置换。Enter any text as a seed and the same input and settings always give the same result; without a seed the browser's secure random generator is used. Show the permutation lists, for each result bit, which original bit it came from — put the bits back accordingly to undo it. With Same shuffle for all values, every value of the same length uses one permutation.
输入和输出是什么样的?What does the input and output look like?
例如在「二进制位随机打乱(洗牌,保持 1 的个数)」中输入 10110000,「种子(留空 = 随机)」设为 abc,输出为:00101010(⏎ 表示换行)。For example, the Shuffle Binary Bits turns the input 10110000, "Seed (blank = random)" set to abc into: 00101010 (⏎ marks a line break).
有哪些选项可以调整?What options can I adjust?
「二进制位随机打乱(洗牌,保持 1 的个数)」的设置:「种子(留空 = 随机)」可留空;可勾选:「所有数用同一种打乱方式」、「显示置换(每一位的来源)」、「加 0b 前缀」、「每 4 位加空格」。改动任一选项后结果会按新设置重新生成。Settings in the Shuffle Binary Bits — "Seed (blank = random)" optional; tick boxes: "Same shuffle for all values", "Show the permutation", "Add 0b prefix", "Space every 4 bits". Changing any option regenerates the result with the new setting.
代码或数据会被上传吗?Is my code or data uploaded?
不会。「二进制位随机打乱(洗牌,保持 1 的个数)」完全用 JavaScript 在本地运行,适合处理含有密钥、内部接口等敏感内容的数据。No. The Shuffle Binary Bits runs entirely in local JavaScript, so it is safe for data containing keys or internal endpoints.
「二进制位随机打乱(洗牌,保持 1 的个数)」免费吗?需要注册吗?Is the Shuffle Binary Bits free? Do I need an account?
「二进制位随机打乱(洗牌,保持 1 的个数)」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Shuffle Binary Bits is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.