This commit is contained in:
aixianling
2025-01-09 17:45:40 +08:00
commit 5c9f1dae4a
3482 changed files with 1146531 additions and 0 deletions

41
sdk/utils/wrand.h Normal file
View File

@@ -0,0 +1,41 @@
#ifndef _WELL_RNG_H_
#define _WELL_RNG_H_
/******************************************************************
*
* wyLib库 2008 - 2011
*
* $ 基于WELL算法实现的快速随机函数库 $
*
* - 主要功能 -
*
* 实现快速的波动更无规律的随机数算法
*
*****************************************************************/
/*
* Comments: 使用WELL算法产生一个随机数产生的随机数在0到max以内。
* Param unsigned long max: 随机数上限
* @Return unsigned long:
*/
#ifdef __cplusplus
extern "C" {
#endif
//范围一个[0,max)之间的随机数
unsigned long wrand(unsigned long max);
/*
* Comments: 初始化随机种子表
* Param unsigned int seed: 种子值如果值为0则自动使用time()值作为种子
* 该函数在整个程序中调用一次即可。也可以不调用只是每次运行第N次随机产生的值都一样。
*/
void winitseed(unsigned int seed);
//返回一个随机数
unsigned long wrandvalue();
#ifdef __cplusplus
}
#endif
#endif