#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
srand((unsigned int)time(NULL));
int x = rand() % 3 + 1;
int y = rand() % 3 + 1;
printf("%d%d",x,y);
return 0;
}
利用时间来产生随机数
于 2021-11-20 19:56:43 首次发布
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
srand((unsigned int)time(NULL));
int x = rand() % 3 + 1;
int y = rand() % 3 + 1;
printf("%d%d",x,y);
return 0;
}