This commit is contained in:
Nikolaj
2021-09-27 12:36:29 +02:00
parent 4e879f3163
commit 7f22e73b91
11 changed files with 569 additions and 0 deletions

25
A1/random_ids.c Normal file
View File

@ -0,0 +1,25 @@
#include <stdio.h>
#include <stdlib.h>
#include "record.h"
int main(int argc, char** argv) {
if (argc != 2) {
fprintf(stderr, "Usage: %s FILE\n", argv[1]);
return 1;
}
int n;
struct record* rs = read_records(argv[1], &n);
if (!rs) {
fprintf(stderr, "Failed to read records from %s\n", argv[1]);
return 1;
}
while (1) {
if (printf("%ld\n", (long)rs[rand() % n].osm_id) == 0) {
break;
}
}
}