Might as well post this here, see if Keith/X/someone else has a clever idea.
Given two inputs that are the X and Y coordinates of a location, write a function that produces a single boolean output that adheres, as best as possible, to the following criteria:
1) The output will be drawn to a bitmap display. False will draw white, true will draw red.
2) Red pixels will be less common than white pixels, exact ratio is unimportant
3) Red pixels will be _no closer_ than 8 pixels, but the ideal distance would be between 16 and 32.
4) There is to be no randomization in determining the output or storage of previous results
5) Most importantly, the resulting image should have the _appearance_ of random noise.
For example:
function generate(int x, int y) {
//the modulo does not have a linear relationship with regards to the frequency of output
//primes *tend* to perform better, but this is not always the case
return ((X * X + Y * Y + (int)Math.pow(X * Y, 3)) % 27 == 0);
}
Which results in the following output (0,0 upper left, grid size is 10x10 real pixels)
This happens to have some symmetry, but I am less concerned about that than I am about the distance between each *true* point.
Another example:
function generate(int x, int y) {
//the modulo does not have a linear relationship with regards to the frequency of output
//primes *tend* to perform better, but this is not always the case
return (((1+X) * X + Y * Y + (int)Math.pow(X * Y, 3)) % 257 == 0);
}
(Excel had a sign bit-overflow in the lower right corner; my usage won't care about such things, as I
do want random-like results)