求一个能产生随机数的函数。我的为什么不能用
时间:10-02
整理:3721RD
点击:
#include "msp430f449.h"
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
int i,k;
srand( (unsigned)time( NULL ) );
for( i = 0; i < 10;i++ )
k= rand()%100+1;
while(1);
}
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
main( void )
{
// Stop watchdog timer to prevent time out reset
WDTCTL = WDTPW + WDTHOLD;
int i,k;
srand( (unsigned)time( NULL ) );
for( i = 0; i < 10;i++ )
k= rand()%100+1;
while(1);
}