APL/APL1.1/CM2/lancer.c

17 lines
353 B
C
Raw Normal View History

2022-01-25 14:25:17 +01:00
#include <stdio.h>
#include <stdlib.h>
int main(void) {
FILE* file = fopen("/dev/random", "r");
if (file) {
unsigned char randVal;
fread(&randVal, 1, 1, file);
printf("%d\n", (randVal % 6) + 1);
} else {
puts("Impossible d'ouvrir le fichier.");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}