You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
700 B
C

12 years ago
#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(void) {
12 years ago
unsigned long seed = mix(clock(), time(NULL), getpid());
srand(seed);
char* wo[] = { "unibib", "blb", "theater" };
int i = rand() % 3;
printf("%s\n", wo[i]);
}