You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为Dieharder测试工具编写并添加自定义RNG?

基于3段帐篷映射的*伪随机数生成器(RNG)*实现代码片段

我正在编写一款伪随机数生成器(RNG),采用了3段式帐篷映射的算法,并且基于dieharder库的接口规范来开发,目前完成的代码片段如下:

#include <dieharder/libdieharder.h>

static unsigned long int tent3_get (void *vstate);
static double tent3_get_double (void *vstate);
static void tent3_set (void *vstate, unsigned long int s);

typedef struct { double seed; } tent3_state_t;

static unsigned long int tent3_get (void *vstate) {
 double nextx = seed;
 double current = nextx;
 if(current <= 1.0/3.0){
 nextx = 3.0 * current;
 }else if(current <= 2.0/3.0){
 nextx = 3.0 * current - 1.0;
 }else if(current <...

内容的提问来源于stack exchange,提问作者StarChar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 11:49:56