这是一份示例代码,实现了洗牌和发牌的功能:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 52
void shuffle(int deck[]) {
for (int i = 0; i < N; i++) {
int j = i + rand() / (RAND_MAX / (N - i) + 1);
int t = deck[j];
deck[j] = deck[i];
deck[i] = t;
}
}
int