wo lernen?
parent
ff5ec6af02
commit
15840e821d
@ -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…
Reference in New Issue