[PIC®/AVR®/dsPIC®产品] pic16的伪随机数库函数在那个头文件中

[复制链接]
1757|4
 楼主| 地瓜patch 发表于 2014-8-14 15:07 | 显示全部楼层 |阅读模式
第一个回答正确的奉送20分
 楼主| 地瓜patch 发表于 2014-8-14 15:40 | 显示全部楼层
突然找到了
/** @name rand
* The {\bf rand} function generates a sequence of pseudo-random integer
* values in the range [0,RAND_MAX].
*
* The implementation shall behave as if no library function calls {\bf rand}.
*/
int rand (void);
/** @name srand
* The {\bf srand} function sets the starting seed for the pseudo-random
* number sequence generated by the {\bf rand} function. If {\bf srand} is
* called again with the same seed value, the same sequence of value shall
* be returned by {\bf rand}. If {\bf rand} is called without {\bf srand}
* having first been called, the pseudo-random sequence of numbers generated
* shall be the same as if {\bf srand} had been called with a seed value
* of 1.
*
* The implementation shall behave as if no library function calls {\bf srand}.
*/
void srand (auto unsigned int seed);
 楼主| 地瓜patch 发表于 2014-8-14 15:43 | 显示全部楼层
void srand (auto unsigned int seed); 没有返回值,但是若要取得带种子随机数的返回值,就是调用同样种子的srand()两次,然后返回值就是调用rand()的返回值。
zhimagod 发表于 2014-8-14 15:55 | 显示全部楼层
学习+接分
530120101 发表于 2014-8-14 16:05 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册

本版积分规则

个人签名:出一块TI-PLABS-AMP-EVM

1943

主题

15258

帖子

31

粉丝
快速回复 在线客服 返回列表 返回顶部