3 Star 21 Fork 17

Cliven / randomness

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
approximate_entropy_test.go 547 Bytes
一键复制 编辑 原始数据 按行查看 历史
Sun Yimin 提交于 2022-11-02 09:33 . refactor test cases and data
package randomness
import (
"fmt"
"testing"
)
var sampleTestBits100 []bool
func init() {
sampleTestBits100 = B2bitArr([]byte{0xc9, 0xf, 0xda, 0xa2, 0x21, 0x68, 0xc2, 0x34, 0xc4, 0xc6, 0x62, 0x8b, 0x80})
sampleTestBits100 = sampleTestBits100[:100]
}
func TestApproximateEntropyTestSample(t *testing.T) {
p, q := ApproximateEntropyProto(sampleTestBits100, 2)
fmt.Printf("n: %v, P-value: %f, Q-value: %f\n", len(sampleTestBits100), p, q)
if fmt.Sprintf("%.6f", p) != "0.235301" || fmt.Sprintf("%.6f", q) != "0.235301" {
t.FailNow()
}
}
Go
1
https://gitee.com/Trisia/randomness.git
git@gitee.com:Trisia/randomness.git
Trisia
randomness
randomness
master

搜索帮助