|
@@ -1,3 +1,4 @@
|
|
|
+#define _XOPEN_SOURCE
|
|
|
#include <stdio.h>
|
|
|
#include <stdlib.h>
|
|
|
#include <X11/Xlib.h>
|
|
@@ -5,7 +6,7 @@
|
|
|
|
|
|
#define WIDTH 1280
|
|
|
#define HEIGHT 720
|
|
|
-#define SEED 8081
|
|
|
+#define SEED 1234567
|
|
|
|
|
|
#define POINTS 20
|
|
|
|
|
@@ -35,13 +36,8 @@ void draw_pixel(Display * di, Window wi, GC gc, int x, int y, int color)
|
|
|
|
|
|
float rand_0_1()
|
|
|
{
|
|
|
- int o0;
|
|
|
- float o0f, r;
|
|
|
- srand(SEED + seed_offset++); // define random initial seed
|
|
|
- o0 = rand();
|
|
|
- o0f = (float) o0;
|
|
|
- r = o0f / RAND_MAX;
|
|
|
- return (r);
|
|
|
+ srand48(SEED + seed_offset++);
|
|
|
+ return drand48();
|
|
|
}
|
|
|
|
|
|
void sort(double *arr)
|
|
@@ -133,8 +129,10 @@ int main()
|
|
|
int z = 50;
|
|
|
while (!quit) {
|
|
|
int a = XNextEvent(di, &ev);
|
|
|
- if (ev.type == KeyPress)
|
|
|
- quit == 1;
|
|
|
+ if (ev.type == KeyPress) {
|
|
|
+ printf("KeyPress %x\n", ev.xkey.keycode);
|
|
|
+ quit = 1;
|
|
|
+ }
|
|
|
if (ev.type == Expose) {
|
|
|
worley_noise(di, wi, gc);
|
|
|
}
|