Seed random number generation from time

This commit is contained in:
Camden Dixie O'Brien 2024-11-03 21:50:32 +00:00
parent 521be83dbb
commit e55ae6f355

6
main.c
View File

@ -8,6 +8,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/time.h>
#define MAZE_SIZE 24 #define MAZE_SIZE 24
@ -105,7 +106,10 @@ static void draw_maze(Display *dpy, Window w, GC gc, const maze_t *m)
int main(void) int main(void)
{ {
srand(1891342542362697); // Seed random number generation from time
struct timeval tv;
gettimeofday(&tv, NULL);
srand(tv.tv_usec);
XEvent evt; XEvent evt;
Display *dpy = XOpenDisplay(NULL); Display *dpy = XOpenDisplay(NULL);