打印
[PIC®/AVR®/dsPIC®产品]

pic16的伪随机数库函数在那个头文件中

[复制链接]
1380|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 | 只看该作者
学习+接分

使用特权

评论回复
5
530120101| | 2014-8-14 16:05 | 只看该作者

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

1178

主题

11364

帖子

27

粉丝