01 //The probably of a star appearing is 1/16 02 #define STAR_SPACING 64 03 Bool Star(I64 *_x,I64 *_y) { 04 I64 r; 05 I64 x=*_x; 06 I64 y=*_y; 07 x/=STAR_SPACING; 08 y/=STAR_SPACING; 09 I64 seed=y<<24+x<<16; 10 Fs->rand_seed=seed; 11 //LINEAR conjugence,run a couple of times to avoid "linear" randonness 12 RandU64; 13 RandU64; 14 r=RandU64>>48; 15 if(0==r&(0b111<<12)) { 16 *_x=x*STAR_SPACING+r&0x3f; 17 *_y=y*STAR_SPACING+(r>>6)&0x3f; 18 return TRUE; 19 } 20 *_x=I32_MAX; 21 *_y=I32_MAX; 22 return FALSE; 23 }