wo lernen?
This commit is contained in:
parent
ff5ec6af02
commit
15840e821d
3 changed files with 29 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,3 +14,4 @@ checkcheck
|
||||||
multibrot
|
multibrot
|
||||||
multibrot.png
|
multibrot.png
|
||||||
bloom
|
bloom
|
||||||
|
wo-lernen
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -1,7 +1,7 @@
|
||||||
CFLAGS=-std=c99 -Wall -g -O2
|
CFLAGS=-std=c99 -Wall -g -O2
|
||||||
INDENTOPTS=-kr --no-tabs --braces-on-func-def-line --indent-level2
|
INDENTOPTS=-kr --no-tabs --braces-on-func-def-line --indent-level2
|
||||||
|
|
||||||
TARGETS=approximate-pi linked-list mandelbrot threads circular-buffer structs ncurses-pong bit-fuckery bit-fuckery2 checkcheck multibrot bloom
|
TARGETS=approximate-pi linked-list mandelbrot threads circular-buffer structs ncurses-pong bit-fuckery bit-fuckery2 checkcheck multibrot bloom wo-lernen
|
||||||
EXTRAS=mandelbrot.bmp multibrot.png
|
EXTRAS=mandelbrot.bmp multibrot.png
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
27
wo-lernen.c
Normal file
27
wo-lernen.c
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
// http://www.concentric.net/~Ttwang/tech/inthash.htm
|
||||||
|
unsigned long mix(unsigned long a, unsigned long b, unsigned long c) {
|
||||||
|
a=a-b; a=a-c; a=a^(c >> 13);
|
||||||
|
b=b-c; b=b-a; b=b^(a << 8);
|
||||||
|
c=c-a; c=c-b; c=c^(b >> 13);
|
||||||
|
a=a-b; a=a-c; a=a^(c >> 12);
|
||||||
|
b=b-c; b=b-a; b=b^(a << 16);
|
||||||
|
c=c-a; c=c-b; c=c^(b >> 5);
|
||||||
|
a=a-b; a=a-c; a=a^(c >> 3);
|
||||||
|
b=b-c; b=b-a; b=b^(a << 10);
|
||||||
|
c=c-a; c=c-b; c=c^(b >> 15);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
unsigned long seed = mix(clock(), time(NULL), getpid());
|
||||||
|
srand(seed);
|
||||||
|
|
||||||
|
char* wo[] = { "unibib", "blb", "theater" };
|
||||||
|
int i = rand() % 3;
|
||||||
|
printf("%s\n", wo[i]);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue