rand_r (unsigned int *seed)函数的实现
来源:互联网 发布:阿里云os安装应用失败 编辑:程序博客网 时间:2024/04/29 18:30
rand_r(unsigned int *seed)函数的实现
int rand_r (unsigned int *seed)
{
unsigned int next = *seed;
int result;
next *= 1103515245;
next += 12345;
result = (unsigned int) (next / 65536) % 2048;
next *= 1103515245;
next += 12345;
result <<= 10;
result ^= (unsigned int) (next / 65536) % 1024;
next *= 1103515245;
next += 12345;
result <<= 10;
result ^= (unsigned int) (next / 65536) % 1024;
*seed = next;
return result;
}
- rand_r (unsigned int *seed)函数的实现
- 生成伪随机数的函数int rand(void)和void srand(unsigned seed);
- C++随机选择的实现 rand函数和rand_r
- rand()函数是从seed到maximum(一般是unsigned int 32767),seed为time(0)会不会超了
- 实现string到unsigned int的转换
- 函数参数的int &和unsigned int &没法兼容
- 无符号整数翻转函数实现reverse_bits(unsigned int value)
- 字符串转unsigned int函数-C语言实现
- int unsigned int longlong unsigned longlong 的取值范围
- int 与 unsigned int、unsigned char 的计算
- (volatile unsigned int *)的理解
- unsigned long int 的陷阱
- (volatile unsigned int *)的理解
- 关于unsigned int的 问题
- int和unsigned int的区别- -
- unsigned int 和int 的区别
- unsigned int与int相加的问题
- int和unsigned int的混合运算
- C++ 定时器使用
- tpc-c测试环境搭建
- QClub大连站2013年第一期总结
- 使用CAsyncSocket类进行网络编程
- 《coredump问题原理探究》Linux x86版3.7节栈布局之返回值
- rand_r (unsigned int *seed)函数的实现
- html5 WebSocket在jetty7中的实现
- MongoDB 存放图片
- 编程工具网站
- 番茄学习法及番茄钟软件 Pomodairo 1.9
- wince对中文字体的支持
- 合法括号式的最大长度求法(没有优先级时)
- 汉诺塔问题 背包问题
- CSS中background-position详述