1
3
我认为一个好的候选人是 斐波纳契线性反馈移位寄存器(LFSR) . 你可以从 Wikipedia . 只是摘录: The initial value of the LFSR is called the seed, and because the operation of the register is deterministic, the stream of values produced by the register is completely determined by its current (or previous) state. Likewise, because the register has a finite number of possible states, it must eventually enter a repeating cycle. However, an LFSR with a well-chosen feedback function can produce a sequence of bits which appears random and which has a very long cycle.
唯一的问题是lfsr的周期总是格式2
n
- 1。
所以,要抑制k值(k=((2
n
-1)-p){1…,2
(n-1)
-1})您可以添加一些逻辑,例如
|
John V · 是否存在单元测试无法发现的逻辑/流错误类型? 6 年前 |
Beefster · 为什么ANSI颜色转义以“m”而不是“]”结尾? 6 年前 |
Guillermo Gutiérrez · STR转换是如何工作的? 7 年前 |
RudziankoÅ · 合并排序数组算法 7 年前 |
user8852560 · 构造函数中的验证和构造函数冲突 7 年前 |
jav974 · 订购产品时寻找最佳价格组合的算法 7 年前 |
hippietrail · 确定浮点数中前导零的数量 7 年前 |