Skip to content

Instantly share code, notes, and snippets.

@kusma
Created August 3, 2010 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kusma/506563 to your computer and use it in GitHub Desktop.
Save kusma/506563 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#define MAG 3
#define SIZE (1 << MAG)
const int seed[2][2] = {{0, 2}, {3, 1}};
int main()
{
int x, y;
for (y = 0; y < SIZE; ++y, putchar('\n'))
for (x = 0; x < SIZE; ++x) {
int i, v = 0;
for (i = 0; i < MAG; ++i)
v = 4 * v + seed[(x >> i) & 1][(y >> i) & 1];
printf("%2d ", v);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment