forked from Trisia/randomness
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
135 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package randomness | ||
|
||
// Alpha 显著性水平α | ||
const Alpha = 0.01 | ||
|
||
// TestResult 检测结果 | ||
type TestResult struct { | ||
Name string // 检测名称 | ||
P float64 // 检测结果 | ||
P2 float64 // 检测结果P2 | ||
Pass bool // 是否大于等于显著水平 | ||
} | ||
|
||
// TestFunc 测试方法 | ||
type TestFunc func([]byte) *TestResult | ||
|
||
// TestItem 测试项目 | ||
type TestItem struct { | ||
Name string // 检测名称 | ||
// 检测方法 | ||
Runner TestFunc | ||
} | ||
|
||
// TestMethodArr 测试方法序列 | ||
var TestMethodArr = []TestItem{ | ||
{"单比特频数检测", MonoBitFrequency}, | ||
{"块内频数检测", FrequencyWithinBlock}, | ||
{"扑克检测", Poker}, | ||
{"重叠子序列检测", OverlappingTemplateMatching}, | ||
{"游程总数检测", Runs}, | ||
{"游程分布检测", RunsDistribution}, | ||
{"块内最大“1”游程检测", LongestRunOfOnesInABlock}, | ||
{"二元推导检测", BinaryDerivative}, | ||
{"自相关检测", Autocorrelation}, | ||
{"矩阵秩检测", MatrixRank}, | ||
{"累加和检测", Cumulative}, | ||
{"近似熵检测", ApproximateEntropy}, | ||
{"线型复杂度检测", LinearComplexity}, | ||
{"通用统计检测", MaurerUniversal}, | ||
{"离散傅里叶检测", DiscreteFourierTransform}, | ||
} |