#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void main() {
int a[54];
for (int i = 0; i < 54; i++) {
printf("%d ", a[i] = i);
}
srand((unsigned int)time(NULL));//随机数种子
for (int i = 0; i < 53; i++) {
int num =i+ rand() % (53 - i);// 取随机数
int temp = a[i];
a[i] = a[num];
a[num] = temp;
}
printf("\n洗牌之后");
for (int i = 0; i < 54; i++) {
printf("%d ", a[i]);
}
system("pause");
}
扑克洗牌
最新推荐文章于 2024-07-19 22:37:45 发布