Seed random number generation from time
This commit is contained in:
parent
521be83dbb
commit
e55ae6f355
6
main.c
6
main.c
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user