Path: utzoo!attcan!uunet!wuarchive!zaphod.mps.ohio-state.edu!rpi!uupsi!eye!erich From: erich@eye.com ( Eric Haines) Newsgroups: comp.graphics Subject: Re: bit masks Message-ID: <1990Sep05.142627.3478@eye.com> Date: 5 Sep 90 14:26:27 GMT References: <23900013@sunb4> Reply-To: erich@eye.com ( Eric Haines) Organization: 3D/Eye Inc., Ithaca, NY Lines: 60 In article <23900013@sunb4> mcooper@sunb4.cs.uiuc.edu writes: > >I'm looking for an algorithm (or C code, of you have it) to generate >16 x 16 bit masks. Ideally, I should be able to specify a percentage and >the program should spit out the pattern filled appropriately. > >ie. > >100% yeilds > >1111111111111111 >1111111111111111 >1111111111111111 >1111111111111111 >1111111111111111 >1111111111111111 >1111111111111111 >1111111111111111 >1111111111111111 >1111111111111111 >1111111111111111 >1111111111111111 >1111111111111111 >1111111111111111 >1111111111111111 >1111111111111111 > >This is no problem to write,m but the simple way gives you nasty artifacts such >as: 25 % yeilds > >1000100010001000 >1000100010001000 >1000100010001000 >1000100010001000 >1000100010001000 >1000100010001000 >1000100010001000 >1000100010001000 >1000100010001000 >1000100010001000 >1000100010001000 >1000100010001000 >1000100010001000 >1000100010001000 >1000100010001000 >1000100010001000 > > >Does anyone have code that will properly randomize this stuff to avoid the >inevitable artifacts and moire patterns? > > >+-------------------------------------+---------------------------------------+ >| "When the going gets weird, | | >| the weird turn pro." | Marc Cooper marcc@ncsa.uiuc.edu | >| | National Center for Supercomputing | >| -Hunter S. Thompson | Applications | >+-------------------------------------+---------------------------------------+ >| Disclaimer: "It's mine! It's all mine!!" -D. Duck | >+-----------------------------------------------------------------------------+