24点随机发牌算法
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
time_t t;
int count=4; //计数器(为达到13张符合要求的牌计数)
srand(time(&t));
int m,n;
printf("输出10个随机数:\n");
while(count)
{
n=rand()%10;
if(n>0)
{
printf("%d ",n);
count--;
}
m=rand()%100;
if(m>=10&&m<=13)
{
printf("%d ",m);
count--;
}
}
return 0;
}
编译能通过,想要的结果也能实现,最关键的问题是运行几十次就可能导致数字刷屏
请问各位高手这是什么引起的??怎么解决?