atrybut const podpis = {A_BOLD, COLOR_RED};
atrybut const gwiazdka = {A_BOLD, COLOR_YELLOW};
+void inicjuj_rng()
+{
+ unsigned ziarno = 0;
+ FILE* f = fopen("/dev/urandom", "rb");
+ if (f != NULL) {
+ unsigned nowe_ziarno;
+ if (fread(&nowe_ziarno, sizeof nowe_ziarno, 1, f) == 1) {
+ ziarno = nowe_ziarno;
+ }
+ fclose(f);
+ }
+ if (ziarno == 0) {
+ ziarno = time(NULL);
+ }
+ srand(ziarno);
+}
+
char const rysunek[] =
" *\n"
" /.\\\n"
int main()
{
- srand(time(NULL));
+ inicjuj_rng();
setupterm(NULL, 1, NULL);
atrybut const* kolor = &choinka;
for (int i = 0; rysunek[i] != '\0'; i++) {