Slashdot Mirror


Using Prime Numbers to Generate Backgrounds

bpeh123 pointed out an article about generating organically tiled backgrounds inspired by the life cycle of cicadas. The trick is to overlay multiple background tiles with prime widths thus generating a series that does not repeat for a sufficiently long period. This introduces a seeming irregularity and makes the background appear much more natural.

180 comments

  1. Let me be the first to say... by multipartmixed · · Score: 2, Interesting

    ...NEEEEEEieieiirrrnngngne eEEEEEEEEEEee eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeernrng!

    --

    Do daemons dream of electric sleep()?
    1. Re:Let me be the first to say... by Anonymous Coward · · Score: 1

      Coach Z?

    2. Re:Let me be the first to say... by Anonymous Coward · · Score: 0

      If anyone wooshed @ the parent, I can tell you the exact the episode and anime names where that particular cicada sample went for the soundrack.
      You're welcome.

    3. Re:Let me be the first to say... by Anonymous Coward · · Score: 0

      What anime? Hayate no Gotoku?

    4. Re:Let me be the first to say... by EdZ · · Score: 1

      The correct answer is: EVERY anime. That same damn cicada sound effect is like the Wilhelm Scream of Japan.

    5. Re:Let me be the first to say... by mwvdlee · · Score: 1

      It's a nice idea.
      Too bad it's not supported by the majority of browsers.
      Try again in a few years, when all IE6-using companies have finally upgraded to IE7.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
    6. Re:Let me be the first to say... by X0563511 · · Score: 1

      Wait, what? They all sound the same anyways! Every blasted one of the little bastards sounds the same! Such an evil sound!

      --
      For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
    7. Re:Let me be the first to say... by Anonymous Coward · · Score: 0

      Internet Explorer 6 is dead, unless you have visitors from China and a few other Asian countries: http://ie6countdown.com/ (That's a Microsoft site!)

      According to Statcounter, IE6 currently has 1.8% market share in Europe and 2% in North America. Unless you KNOW that your customers are more likely than the average person to use IE6, there's no way to justify the extraordinary additional cost of supporting that rubbish browser.

      Currently, the low level of fancy tricks support is IE7, which will have declined enough to be ignored in about two years. Besides, this neat background trick is easy to make degrade gracefully.

    8. Re:Let me be the first to say... by maxwell+demon · · Score: 1

      Internet Explorer 6 is dead, unless you have visitors from China and a few other Asian countries: http://ie6countdown.com/ [ie6countdown.com] (That's a Microsoft site!)

      If you visit that site with JavaScript off, you get the nice statement:
      "100% | 2011 MAR
      of the world was using Internet Explorer 6, which was 8.1 percentage points less than the previous year"

      --
      The Tao of math: The numbers you can count are not the real numbers.
    9. Re:Let me be the first to say... by asdf7890 · · Score: 1

      It is hardly a new idea: I've seen similar things done before, though with the images as the backgrounds to divs rather than as multiple background values for the html or body tags.

      Heck, some old 8/16-bit games (scrollers mainly) used a similar technique to draw their backgrounds, and it can also be a cheap way to distribute items around a map (pick a few of pseudo-random primes, and use them in a 2D grid to decide where to put things: items go on or near points where the patterns produced by the primes coincide). Modifications of the method can be used in many places where you want a regular, reasonably "fair", but not easily predictable distribution - and if done right the result feels natural because we are used to nature being very regular at a macro level but not so predictable at a more detailed scale. Something that is too regular seems wrong, and something too irregular does too - this method produces a handy middle ground.

      It can even be a handy way to pick test data from a larger set ("select * from somewhere where rowid is a multiple of 17 or a multiple of 37" or some such): the resulting set is not regular (so you are there is less chance of accidentally introducing a bias that skips some important cases while picking data by other means) but is repeatable (so if the test produces odd results you can rerun it exactly the same way again to analyse the situation, just by plugging the same set of primes into the selection filter).

    10. Re:Let me be the first to say... by mwvdlee · · Score: 1

      The problem isn't so much with the overall average userbase, it's with what company's use; some fairly large companies are still at IE6 whereas the bulk seems to be at IE7 and some "already" at IE8. Sadly, very few companies seem to use any of the other major browsers, even though any of them would be much better than IE6/7/8.

      --
      Slashdot social media options: AIM, ICQ, Yahoo, Jabber and Mobile Text. Why no MySpace?
  2. Fuck you slashdot by Anonymous Coward · · Score: 2, Informative

    Why can I only check Post Anonymously when I post a new comment but not a reply? Also, it would be kinda cool if I could click on fucking links again without having to triple right click and then open in a new window.

    1. Re:Fuck you slashdot by thePowerOfGrayskull · · Score: 0

      Probably because you haven't yet learned the intricacies of the "web browser", the "mouse" and quite possibly "the computer". Orrrr... you're somehow being served up a different version of slashdot than the rest of us.

    2. Re:Fuck you slashdot by spun · · Score: 2, Insightful

      He's not the only one, bucky. No need to be an ass. I don't have the problem with the post anonymously checkbox, but I have not been able to click on any off-site links for a week, using Firefox 3.6.16. Internet Exploder works, but I'm not using that POS.

      --
      - None can love freedom heartily, but good men; the rest love not freedom, but license. -- John Milton
    3. Re:Fuck you slashdot by gstoddart · · Score: 2

      Probably because you haven't yet learned the intricacies of the "web browser", the "mouse" and quite possibly "the computer". Orrrr... you're somehow being served up a different version of slashdot than the rest of us.

      Maybe you are oh-so-lucky as to have Slashdot behave consistently and predictably lately.

      Half of the time when I go to meta-moderate, the +/- buttons don't do anything at all -- they're inert, and clicking on them doesn't do anything. Sometimes, if I browse away and come back, it works. Sometimes it doesn't work for days. I mean, I would expect the behavior of a web page to be deterministic but apparently that's not the case.

      It's been making me go "WTF" for a couple of weeks now. I've even reverted to the oldest-school layout because some of the stuff was acting even weirder.

      It's hard not to conclude there are some things on Slashdot that are working intermittently, and not in ways you might always predict.

      Dial it back ... he's not the only one seeing Slashdot behave somewhat flaky of late.

      --
      Lost at C:>. Found at C.
    4. Re:Fuck you slashdot by Anonymous Coward · · Score: 0

      I can also only post anonymously, but it has to do with being behind a corporate proxy. As soon as I log in and hit refresh or click to another page, I'm logged out again.

    5. Re:Fuck you slashdot by Hognoxious · · Score: 1

      I've even reverted to the oldest-school layout because some of the stuff was acting even weirder.

      Me too, but it still doesn't work properly on a small screen. You get a tiny strip of text between two big white borders, and the stuff at the top all overlaps each other.

      It's like Roseanne Barr in a thong.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    6. Re:Fuck you slashdot by Anonymous Coward · · Score: 0

      Can't post replies anonymously to posts?

    7. Re:Fuck you slashdot by gfreeman · · Score: 1

      He's not the only one. Using Chrome, I have not been able to check the "AC" box this week.

      --
      Ceci n'est pas un sig.
    8. Re:Fuck you slashdot by MozeeToby · · Score: 3, Insightful

      The new UI has been getting more buggy every week rather than less buggy. Off site links not working, clicking 'score' to view how things are moderated collapsing the comment, scrolling issues, clicking anywhere on the comment navigating to the parent, weird highlighting when submitting a comment... and that's just off the top of my head and coming from someone who was initially supportive of the changes. All on FF4.0

    9. Re:Fuck you slashdot by zero0ne · · Score: 1

      Ditto as well Chrome @ 11.0.696.16 beta

    10. Re:Fuck you slashdot by sortius_nod · · Score: 1

      Chrome is fine with the new scheme. A few graphical bugs but everything functions.

    11. Re:Fuck you slashdot by X0563511 · · Score: 2

      I can't even right click now. $DEITY knows how I've been keeping my spelling in check without being able to use the spell.... check.

      --
      For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
    12. Re:Fuck you slashdot by manwargi · · Score: 2

      I have no mod points so yeah frigging THIS. Between right clicking only working half the time, offsite links never working anymore, needing to open up all the parent posts to view post scores, and so much more, the redesign has been quite the pain.

    13. Re:Fuck you slashdot by thePowerOfGrayskull · · Score: 1

      Someone comes and titles a post "fuck you slashdot", yet I'm the one being an ass? Then you go on to describe a completely separate issue (one that I happen to have as well) as if that somehow excuses his post?

    14. Re:Fuck you slashdot by _0xd0ad · · Score: 1

      I was having the same issue with the Post Anonymously checkbox. Then Slashdot apparently reverted the code back to the version where the Post Anonymously checkbox still worked but clicking a post opened its parent posts one by one. (And links seem to work.) So no, it isn't quite as simple as OP being completely computer illiterate. It was actually broken.

    15. Re:Fuck you slashdot by thePowerOfGrayskull · · Score: 1

      Ah, see? Then it really WAS option b) "somehow you're being served up a different version of slashdot than the rest of us" ;)

    16. Re:Fuck you slashdot by spun · · Score: 1

      Yes, you are being an ass. He insulted a fucking WEBSITE, not YOU. You then turned around and insult the guy for pointing out legitimate problems with the site, making you, IMHO, an ass. Separate issue? Reread his post, he mentions the links issue. And what's to excuse? "Fuck you Slashdot" needs an excuse to YOU now, does it, Mr. Arbiter of Language and Morality on the Intertubez?

      --
      - None can love freedom heartily, but good men; the rest love not freedom, but license. -- John Milton
  3. I want... by H0p313ss · · Score: 1

    ... whatever that dude is smoking.

    --
    XML is a known as a key material required to create SMD: Software of Mass Destruction
  4. OMG Sicadas are illuminati by slackzilly · · Score: 1

    "..While this is a rather rockâ(TM)nâ(TM)roll ending for our nerdy cicada, it raises an obvious question: Is it just by chance that they adopted 7, 11, or 13-ââyear life cycles, or are those numbers somehow special?" Those numbers always come up in conspiracy theories.

    --
    - "If one man can create that much hate, you can only imagine how much love we as a togetherness can create."
    1. Re:OMG Sicadas are illuminati by slackzilly · · Score: 1

      wft? that looked allright in the preview.

      --
      - "If one man can create that much hate, you can only imagine how much love we as a togetherness can create."
    2. Re:OMG Sicadas are illuminati by Gordonjcp · · Score: 3, Informative

      Yes, some characters do. The Slashdot Janitors have decreed that only 7-bit ASCII can be used on the site and everything else should be presented in as broken a way as possible.

      Because obviously, we're geeks so we're all using 30-year-old ADM3A terminals.

    3. Re:OMG Sicadas are illuminati by Nefarious+Wheel · · Score: 1

      Hey, I really liked the ADM3A I built from Heathkit!

      --
      Do not mock my vision of impractical footwear
    4. Re:OMG Sicadas are illuminati by Oxford_Comma_Lover · · Score: 1

      Because obviously, we're geeks so we're all using 30-year-old ADM3A terminals.

      Or they're geeks using char strings in the hope that their compilers/interpreters/databases/servers save resources because of that. Doubtful.

      OR they're geeks using a very limited character set for security reasons. More likely. Better to whitelist than blacklist, and their whitelist is small.

      --
      -- IANAL, this isn't legal advice, and definitely isn't legal advice for you. Also, Squee!
    5. Re:OMG Sicadas are illuminati by Hognoxious · · Score: 1

      If GP is correct they support characters at the preview stage but not when it's saved.

      I find it hard to believe that's possible, unless they did it intentionally. Unless they're incredibly shit at code design.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    6. Re:OMG Sicadas are illuminati by _0xd0ad · · Score: 1

      The "old" version botches >7-bit Unicode on both the preview and in the final post. It only looks fine in the editing text area, which I suspect is what OP meant when he said it looked fine in the "preview".

      The AJAX version of the site strips out all of the characters but replaces a select few of them with their HTML-entity equivalents, so copy-and-paste from a website that uses the curly quote characters into a Slashdot comment has the curly quote marks correctly preserved in the comment if it's posted using the new editor. But the vast majority of Unicode characters don't work (including the … horizontal ellipsis character).

      And both versions strip out HTML entity codes that it doesn't recognize.

      Neither version shows something different in the preview from what's actually posted, so OP apparently just didn't notice in the preview. Or, as he was obviously using the old form, maybe he just clicked "submit".

  5. 1 is the loneliest (non-prime) number by Anonymous Coward · · Score: 0, Informative

    From TFA:

    They’re all prime numbers—numbers that can only be divided by themselves and 1 (that is,1, 2, 3, 5, 7, 11, 13, 17, 19, 23, and so on).

    FAIL. 1 is not prime.

    1. Re:1 is the loneliest (non-prime) number by Anonymous Coward · · Score: 0

      What two whole numbers besides one and itself can be multiplied to result in 1?

    2. Re:1 is the loneliest (non-prime) number by Hognoxious · · Score: 2

      One is itself, so it only has one factor. Really.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    3. Re:1 is the loneliest (non-prime) number by toastar · · Score: 1

      But 1 is happy

    4. Re:1 is the loneliest (non-prime) number by Anonymous Coward · · Score: 0

      I've never understood why not, other than definitional fiat.

      And as far as this technique... I'm pretty sure that everybody with half a clue has been using this or a similar technique for the last 20 years (including in certain standard random number generators). I think this is just a new discovery for this particular author. At least he didn't try to patent it!

    5. Re:1 is the loneliest (non-prime) number by maxwell+demon · · Score: 3, Informative

      Primes have, by definition, exactly two factors. 1 has only one: 1.

      Of course, you could define them differently, and a hundred years ago, 1 indeed was considered a prime. But the definition excluding 1 has turned out to be much more useful (because almost everywhere you use primes you'd have to add "except 1" otherwise), therefore 1 is no longer considered prime.

      --
      The Tao of math: The numbers you can count are not the real numbers.
    6. Re:1 is the loneliest (non-prime) number by pjt33 · · Score: 1

      It's rather convenient to be able to say that every natural number has a unique factorisation. It allows you, for example, to take products over the factorisation (e.g. Euler's totient function phi(n) = n * PROD_p|n (1-1/p) which would have to be a product over "p|n AND p>1").

    7. Re:1 is the loneliest (non-prime) number by praxis · · Score: 1

      So one doesn't have to say "primes except 1" most of the time and can instead say "primes". It's just more convenient to exclude it.

    8. Re:1 is the loneliest (non-prime) number by Anonymous Coward · · Score: 0

      What two whole numbers besides one and itself can be multiplied to result in 1?

      Minus one and another minus one..

    9. Re:1 is the loneliest (non-prime) number by Anonymous Coward · · Score: 0

      Who gives a fuck what you think? People who forgotten more than you'll ever know have decided, for reasons that you'll never understand, that 1 IS NOT a prime, so just eat shit and die.

  6. 1 is not prime by PriNT2357 · · Score: 3, Insightful

    They can't even quote an article they link to properly
    Their article: "that is,1, 2, 3, 5, 7, 11, 13, 17, 19, 23, and so on"
    Wikipedia: "2, 3, 5, 7, 11, 13. . ."

    1. Re:1 is not prime by swanzilla · · Score: 1

      True. One is divisible by one and one...primes require distinctness of divisors. Nice catch.

    2. Re:1 is not prime by Anonymous Coward · · Score: 1

      *sigh* ... All prime numbers are divisible by themselves.

    3. Re:1 is not prime by jank1887 · · Score: 2

      yes, but dividing by themselves gives 1 and dividing by 1 gives themselves, hence distinctness of divisors.

    4. Re:1 is not prime by Anonymous Coward · · Score: 0

      But they sighed! That means they know everything about the subject! Don't even try and correct them!

    5. Re:1 is not prime by Anonymous Coward · · Score: 0

      Fun: Google "Is 1 prime", first two results are "Why 1 is Prime" and "Why is the number one not a prime?".

    6. Re:1 is not prime by rahvin112 · · Score: 1

      Yes and dividing prime 1 by itself 1 gives 1 and conversely dividing the prime 1 by 1 gives itself 1. Just like dividing the prime 7 by itself 7 gives 1 and diving the prime 7 by 1 gives itself 7. All prime numbers are divisible by themselves and 1, that's the definition of prime. 1 is a prime number.

    7. Re:1 is not prime by BKX · · Score: 1

      Nope, Sorry. The definition of a prime a number is a whole number with exactly two distinct whole divisors which produce whole quotients. Note the exactly two distinct part. One is divisible by one and itself, yes, but itself is also one, and thus it does not have requisite two distinct divisors but rather one divisor of one used twice.

    8. Re:1 is not prime by Anonymous Coward · · Score: 0

      I'm not aware that distinctness of divisors has anything to do with it. In modern mathematics, the distinction is that primes are not allowed to be units (numbers like 1 and -1 which have multiplicative inverses in the ring, i.e. whose reciprocals are integers). The ideal generated by the prime should be a proper ideal.

    9. Re:1 is not prime by Hognoxious · · Score: 1

      When you divide a prime by itself you get 1. When you divide it by 1 you get itself. Two factors. One AND itself. Not 1 which by coincidence is the same as itself.

      If that's not good enough for you then google it.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    10. Re:1 is not prime by AP31R0N · · Score: 1

      i thought it was that primes have TWO divisors, one AND itself (itself being something other than one). One has one divisor, and does not me the AND requirement (or the two divisors requirement). Or that's what they told us in school in the 80s.

      --
      Utilizing the synergization of benchmark e-solutions to pre-workaround action items!
  7. Other applications. by Toze · · Score: 4, Interesting

    Cool. I've looking at automatically generating stuff for games recently. Obviously, this works for authentic-looking backgrounds, but my friends and I were working on a project that involved automating critter generation using classic predator-prey models. One big worry was the farming-to-death of critters that are part of an ecosystem. This idea might be useful for much more nicely randomized or randomized-seeming mob population/spawning.

    --
    No OS on the planet can protect itself from a user with the admin password. - Yvan256
    1. Re:Other applications. by jank1887 · · Score: 2

      great. now we get the gold farmers in on factoring large primes. all encryption is about to go out the window.

    2. Re:Other applications. by Anonymous Coward · · Score: 0

      I'll bet you 10000$ I can factor any prime you present me, without a computer, in a matter of SECONDS!

    3. Re:Other applications. by ThatsMyNick · · Score: 1

      Seconds? You must be slow!

    4. Re:Other applications. by Just+Some+Guy · · Score: 1

      I'll make it $20,000 if you can tell me whether the number is actually a prime.

      --
      Dewey, what part of this looks like authorities should be involved?
    5. Re:Other applications. by psithurism · · Score: 1

      I understand his desire to make backgrounds look large and random with a minimum of downloading images, but in a game; what's wrong with just using random numbers for critter generation?

    6. Re:Other applications. by iris-n · · Score: 1

      actually, this problem is trivial. see http://en.wikipedia.org/wiki/Miller-Rabin_primality_test

      --
      entropy happens
    7. Re:Other applications. by Toze · · Score: 1

      Nothing, assuming you just want stuff for people to kill. The plan is to generate an ecosystem of varied plants, prey, and predators that can be affected by players; over-harvesting, farming, etc. A simple model based on primes seems, at first glance, to be much more conducive to emergent gameplay than tweaking random numbers.

      --
      No OS on the planet can protect itself from a user with the admin password. - Yvan256
  8. TL;DR by Narksos · · Score: 1, Insightful

    Designer discovers basic properties of the prime numbers (and confuses 1 for a prime).

    1. Re:TL;DR by Anonymous Coward · · Score: 4, Insightful

      How about: Designer discovers new way to use special properties of primes to create more realistic tiled background images.

      C'mon, the results are actually pretty cool.

    2. Re:TL;DR by gstoddart · · Score: 3, Funny

      Designer discovers basic properties of the prime numbers (and confuses 1 for a prime).

      You missed the important thing ... designer creates huge frickin' lego army using a small number of images and some pretty smart use of CSS.

      An army, but make out of lego. Put lasers on them and see who takes over the world. :-P

      --
      Lost at C:>. Found at C.
    3. Re:TL;DR by Anonymous Coward · · Score: 0

      Give it a few more years, then some MD will come around and patent it.

    4. Re:TL;DR by sootman · · Score: 4, Interesting

      How about: Designer comes up with interesting, relevant use of math that all the Math geeks who have been running the WWW for 20 years didn't think of on their own.

      Subtitle: Bitter math nazis harp on his confusion about 1 being a prime.

      --
      Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
    5. Re:TL;DR by hb79 · · Score: 0

      tl;dr? What is this, Digg, Reddit?

      Either you 1) don't RTFA, and base your comment on the summary (this is the default on Slashdot), or you 2) RTFA and apologize for doing so. In case 2, you are entitled to a slightly more insightful comment, but a one-line summary is usually not part of it.

    6. Re:TL;DR by DMUTPeregrine · · Score: 2

      Penrose tiles are cooler. They are aperiodic, the tiling never repeats, instead of just having a long period.

      --
      Not a sentence!
    7. Re:TL;DR by Hognoxious · · Score: 1

      The image file might be a bit of a bandwith hog, though.

      Unless you could somehow make the client machine generate it.

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    8. Re:TL;DR by DMUTPeregrine · · Score: 1

      It's not that hard. There are plenty of programs to generate such patterns, Sam Ruby wrote a nice one in SVG and ECMAScript. It generates it (deliberately) one tile at a time for a cool animation, doing the same as a background would probably be too distracting.

      --
      Not a sentence!
    9. Re:TL;DR by Hognoxious · · Score: 1

      Who said anything about it being hard?

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  9. Re:Ow. That made my brain hurt. by bigsexyjoe · · Score: 2

    It doesn't matter if cicadas are important to birds or any other predator. Predators are important to cicadas.

    In any case, he's talking about making things look random enough for casual observation. He's not talking about some sort of advanced encryption algorithm. We know we can appeal to advance math and chaos theory for truly random. But this is just web design. If someone actually cracks the pattern, it isn't the end of the world.

  10. Kind of neat by bigsexyjoe · · Score: 1

    It's kind of neat that you can involve a little math in something like web design. Granted this isn't calculus, but it's still a fun little way to make neat patterns.

  11. Re:Ow. That made my brain hurt. by spun · · Score: 5, Insightful

    Just because you do not understand something does not make it wrong. Birds haven't "evolved" a boom/bust cycle, that's not how that works. It's the standard predator/prey boom/bust cycle. Birds don't spend vast periods of time underground, you know. Curtains are natural, "natural" here taking the meaning of "organic" rather than "patterned.

    Please, don't be one of those guys who tries to prove how smart they are by attempting to find fault with the article. It does not make you look as smart as you think. The fact that you hurt your brain trying to comprehend something the rest of us had no trouble understanding actually makes you look pretty dumb.

    --
    - None can love freedom heartily, but good men; the rest love not freedom, but license. -- John Milton
  12. Really learned a LOT from that one by erroneus · · Score: 3, Interesting

    Not only did I learn interesting information about the insects I hate the most (and believe me, if I could, I would destroy every last one of the annoying bugs!) but I also learned that you can have multiple images for backgrounds in CSS and have them lay atop one another. (None of the books or software ever seemed to suggest that it was even possible!)

    While the idea is pretty ingenious, if I had known you could specify more than one image for backgrounds, I would have figured this one out on my own -- I have been overlaying images and background images inside of DIVs for a while to get some really nice effects. But now, to be able to lay one atop the another in the same block? AWESOME.

    And yes, at the article says, inferior browsers cannot handle this -- I tried it on IE8 to see what would happen and... yeah... it hung.

    1. Re:Really learned a LOT from that one by DeionXxX · · Score: 1

      CSS3. Lots of cool stuff in there. Background gradients, rounded corners, animation, etc.

    2. Re:Really learned a LOT from that one by Hooya · · Score: 5, Insightful

      > if I had known you could specify more than one image for backgrounds, I would have figured this one out on my own

      You may want to read this: http://en.wikipedia.org/wiki/Egg_of_Columbus

      I have been doing layered images for over 4-5 years (multiple divs with backgrounds layered over one another) to come up with cool effects. But I would have never come up with this. I had been thinking about tiles and the non-random-ness for quite a while too. This didn't occur to me. Now that someone put this together - sure it's simple. But that's the genius of it.

      My hats are off - simple, efficient, brilliant.

    3. Re:Really learned a LOT from that one by Ksevio · · Score: 1

      Up until a few months ago support was even worse. We've only recently gotten support for many useful CSS3 elements.

    4. Re:Really learned a LOT from that one by camperdave · · Score: 1

      Um... If Columbus challenged his critics to stand an egg on it's tip, then why is the statue showing the egg standing on it's end?

      --
      When our name is on the back of your car, we're behind you all the way!
    5. Re:Really learned a LOT from that one by SpinningCone · · Score: 1

      I concur, this was a really cool technique, i had seen a few articles with clever use of transparency for certain effects. this one is pretty sweet though i suspect it takes quite a bit of work to make sure your layers blend in a nice way

      you also still have to avoid uinque features. for example even if you were varying width and height to make say a stone or gravel pattern, if you had one particularly unique stone in the upper layers it would stick out still. same with knots in wood.

      it might have some uses in textures for games.

    6. Re:Really learned a LOT from that one by blincoln · · Score: 2

      It's not *that* revolutionary. A few months ago, I used the same general principle to make a more interesting rotating "please wait" symbol: I made multiple ring animations with transparent backgrounds, with each ring completing one revolution in a different number of frames. I used odd numbers, but not primes specifically. Anyway, the result was conceptually the same - it takes quite awhile before the rings ever line up in exactly the way they started, but only a handful of animation frames are used, because it's separate files overlaid on each other, and each one alone is a short animation. I was thinking of the "counter-rotating concentric rings" look that has been used everywhere from Tron to Dead Space. The designers on those may have even done exactly the same thing I did.

      I'm also curious to see just how useful this specific technique is for things other than website backgrounds. For example, you couldn't use it (at least without modification) for most 3D object textures, because it only introduces variation along one axis.

      --
      "...always new atoms but always doing the same dance, remembering what the dance was yesterday." -Richard Feynman
    7. Re:Really learned a LOT from that one by mrxak · · Score: 1

      Yeah, I've used prime cycles to generate random-like occurrences before. Struck me as obvious, really, though my application of the concept isn't graphical. Anyway, it was a good read. I would love to see something like this put into video game textures for stuff like wood and stone.

    8. Re:Really learned a LOT from that one by ObsessiveMathsFreak · · Score: 1

      True indeed. In fact, I would go farther. I think this has the potential to become a classic textbook example of number theory.

      This is an impressive and visually interesting application of basic number theory. I would not be surprised if we began seeing the presentations modelled on the Legion of Lego showing up in the slides of number theory lectures in the near future.

      --
      May the Maths Be with you!
    9. Re:Really learned a LOT from that one by mrchaotica · · Score: 1

      Because the statue shows the egg in its post-Columbus state.

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

    10. Re:Really learned a LOT from that one by mrchaotica · · Score: 1

      For example, you couldn't use it (at least without modification) for most 3D object textures, because it only introduces variation along one axis.

      That's true for his first two examples (only because he picked inherently non-tiling-in-the-y-direction things), but the third (the Lego army) varied in two dimensions.

      --

      "[Regarding the 'cloud,'] ownership was what made America different than Russia." -- Woz

    11. Re:Really learned a LOT from that one by Jake+Griffin · · Score: 1

      tip = end. Look at this high resolution photograph of him doing it.

      --
      SIG FAULT: Post index out of bounds.
    12. Re:Really learned a LOT from that one by Jake+Griffin · · Score: 1

      you also still have to avoid uinque features. for example even if you were varying width and height to make say a stone or gravel pattern, if you had one particularly unique stone in the upper layers it would stick out still. same with knots in wood.

      If you had RTFA, you would have seen that he mentioned that toward the end. Of course, this is slashdot...

      --
      SIG FAULT: Post index out of bounds.
    13. Re:Really learned a LOT from that one by trb · · Score: 1

      Ya me too, cycling sine wave frequencies with different odd/prime values in x and y to generate wobble patterns. I probably learned about this idea when I was a kid playing with a Spirograph. I still like this tiling hack though.

    14. Re:Really learned a LOT from that one by Sloppy · · Score: 3, Interesting

      It's not *that* revolutionary. A few months ago, I used the same general principle..

      Well, that's the thing. The general principle is ancient. Using parametrics where each output maps to its own relatively prime cycle to get a very long period .. shit, I was doing that 27 years ago on my Vic20 to make some pretty graphs. (Really.) x=cos(t/7); y=sin(t/13); Graph it, varying "t"; it's purty. And it's pretty damn unlikely that I was the first person to discover (not invent) it; anyone fucking around is eventually going to stumble onto this kind of stuff.

      But this is about background images (and not just background images, but background images on web pages), and I sure as hell wasn't doing that on my Vic20.

      This reminds me the basic difficulty with patents. The ideas themselves often really aren't new, so they're not only obvious in hindsight, but they're even obvious to everyone without hindsight if you ever find yourself working on a problem in a certain area, but if you never end up working on the problems, you're never going to use the idea, so a guy really can be first to do something so basic, in 2011. (Whether this guy actually is, I don't know.) Sure, if you were ever assigned the problem of generating an image with a long period, you might invent this. But did you? (Have you ever needed to generate a background image with a long period? If so, then very likely might have done this. If not, then you just wouldn't ever come up with it.)

      And then some poor schmuck of a patent examiner is supposed to make a judgement call that people in general think is fair. No chance; he's doomed to fail, no matter which way he goes.

      All that aside, it's a cool idea and props to the guy. Just don't fucking patent it, ok? ;-)

      I'm also curious to see just how useful this specific technique is for things other than website backgrounds. For example, you couldn't use it (at least without modification) for most 3D object textures, because it only introduces variation along one axis.

      Heh heh.. don't worry, you'll have the any-dimensional case figured out in a few minutes, if you haven't already. :-)

      --
      As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
    15. Re:Really learned a LOT from that one by Anonymous Coward · · Score: 0

      I think you mean PRE-Columbus state, since clearly, the tip is pointing up in the air.

    16. Re:Really learned a LOT from that one by camperdave · · Score: 1

      Tip==pointy end, not blunt end. Anyone can stand an egg on the blunt end.

      --
      When our name is on the back of your car, we're behind you all the way!
    17. Re:Really learned a LOT from that one by Anonymous Coward · · Score: 0

      Well, it's a novel application, but the concept isn't new in computer art and design: It was used ages ago to create less repetitive waveforms in game crack intros and demos by summing up sinus oscillations with prime number periods.

  13. 1 is a prime. by Cyberax · · Score: 1, Informative

    There are two schools of thought, one considers 1 to be a prime (since its divisors are "1" and itself) the other school of thought doesn't. Some proofs work nicer if 1 is considered to be a prime, some proofs don't.

    So it's just a matter of opinion.

    1. Re:1 is a prime. by janisozaur · · Score: 1

      I don't deal with primes every day, but I have yet to see something (article, piece of code, school book, ...) that says that 1 is a prime. Please point me to one.

    2. Re:1 is a prime. by neumayr · · Score: 1

      Well, I'd call it convenience instead of opinion. If you find a proof that works when 1 isn't prime, would you really start over to find a proof that works regardless, or would you just publish and call it a day? Or vice versa.
      I don't know if it's possible that something that can be proven one way can't be proven the other way, but I'm sure there's a proof for that.

      --
      Truth arises more readily from error than from confusion. -Francis Bacon
    3. Re:1 is a prime. by maxwell+demon · · Score: 1

      Today, 1 isn't a prime. But 1912, it was.

      --
      The Tao of math: The numbers you can count are not the real numbers.
    4. Re:1 is a prime. by SuperRenaissanceMan · · Score: 1

      There are two schools of thought

      one of which is correct

      --
      Any comment mentioning moderation is automatically Offtopic.
    5. Re:1 is a prime. by Tynin · · Score: 1

      Today, 1 isn't a prime. But 1912, it was.

      I will admit to not having much knowledge about the history of our pursuit of prime numbers, but I'm at a loss about the page you linked to. I understand where 1 could be considered a prime, but that list also includes numbers 4, 10, 12, 14, etc on that same list of primes. What school of thought would consider those prime? I'm genuinely curious, because I feel like I must be missing something obvious.

    6. Re:1 is a prime. by Anonymous Coward · · Score: 3, Informative

      A lot of proofs in recursion / computability theory actually depend on the fact that one is not a prime number. More specifically, they depend on the property of numbers that is called unique factorisation into primes, a very important theorem in mathematics that is a corner stone for many proofs in a variety of mathematical disciplines. If you count 1 as a prime number, this theorem does not hold, with all the consequences that you might suspect it entails.

      Just sayin'. 1 is not a prime number.

    7. Re:1 is a prime. by Anonymous Coward · · Score: 0

      1, 2, 3, 4, 5, 7, 10, 11, 12, 14, 15, 18, ... (the linked-to OEIS sequence) is the "old-fashioned" version of "x such that 1+3x(x-1) is prime". That is, 1+3*1*(1-1)=1, 1+3*2*(2-1)=7, 1+3*3*(3-1)=19, 1+3*4*(4-1)=37, etc. The first entry (1) should be omitted, since 1+3*1*(1-1)=1 is no longer considered a prime.

    8. Re:1 is a prime. by nullCRC · · Score: 1

      Nice pun.

      --
      Vescere bracis meis.
    9. Re:1 is a prime. by maxwell+demon · · Score: 1

      Sorry, I should have linked to http://oeis.org/A008578 (although it doesn't mention the year 1912).

      --
      The Tao of math: The numbers you can count are not the real numbers.
    10. Re:1 is a prime. by ObsessiveMathsFreak · · Score: 4, Informative

      This is in fact true.

      The best reason for leaving one out of the prime number set is because it enables you to state the prime number theorem more succinctly:

      Every integer n>1 has a unique factorisation as a product of primes (Prime factorisation)

      If one was prime, then the factorisation would not be unique. For example 6=2.3, but if 1 was an allowed prime then 6=1.2.3=1.1.2.3=1.1.1.2.3= .... 1^n .2.3. So it's preferred to leave one out.

      There are other reasons, but the prime number theorem is perhaps the best one.

      --
      May the Maths Be with you!
    11. Re:1 is a prime. by Jake+Griffin · · Score: 1

      It also doesn't include 13 or 17. That's because that list is "numbers such that 1+3x(x-1) is a 'cuban' prime" and not a list of prime numbers.

      --
      SIG FAULT: Post index out of bounds.
    12. Re:1 is a prime. by Jake+Griffin · · Score: 1

      So, you're saying that a prime number of said schools of thought is correct then?

      --
      SIG FAULT: Post index out of bounds.
    13. Re:1 is a prime. by Anonymous Coward · · Score: 1

      This is in fact true.

      The best reason for leaving one out of the prime number set is because it enables you to state the prime number theorem more succinctly:

      Every integer n>1 has a unique factorisation as a product of primes (Prime factorisation)

      If one was prime, then the factorisation would not be unique. For example 6=2.3, but if 1 was an allowed prime then 6=1.2.3=1.1.2.3=1.1.1.2.3= .... 1^n .2.3. So it's preferred to leave one out.

      There are other reasons, but the prime number theorem is perhaps the best one.

      I don't think there's much debate about this among mathematicians. The uniqueness of factorization alone is important enough to disallow 1 as a prime. (Oh, and it's the Fundamental Theorem of Arithmetic; the Prime Number Theorem is something quite different.)

    14. Re:1 is a prime. by Anonymous Coward · · Score: 0

      Could you give an example of a proof that actually does work nicer if 1 is considered to be a prime? I honestly wasn't able to think of one, but maybe that is because the fundamental theorem of arithmetic is so central to my field.

    15. Re:1 is a prime. by Anonymous Coward · · Score: 0

      Definitions that are a matter of opinion are a pain -- it's much better if we all agree on one definition. The definition of prime is no longer a matter of opinion. If you want to include one, you instead say "1 and the prime numbers ...".

    16. Re:1 is a prime. by PhilHibbs · · Score: 1

      The way I think of it is, prime numbers are the building blocks of numbers. When you find a new prime number, you can use multiplication to make new numbers that you couldn't make before. The number 1 doesn't help making new numbers, so it isn't a multiplicational building block.

    17. Re:1 is a prime. by PhilHibbs · · Score: 1

      Every integer n>1 has a unique factorisation as a product of primes (Prime factorisation)

      Is that theorem supposed to include the prime numbers?

    18. Re:1 is a prime. by Anonymous Coward · · Score: 0

      (What you refer to as the prime number theorem is usually called the fundamental theorem of arithmetic.
      The PNT is a statement about the asymptotic behaviour of prime density.)

    19. Re:1 is a prime. by maxwell+demon · · Score: 1

      Every integer n>1 has a unique factorisation as a product of primes (Prime factorisation)

      Is that theorem supposed to include the prime numbers?

      Yes. The prime factorization of 2 contains only the factor 2, once.
      Note that the product of one number is the number itself.
      Actually, you could even relax the ">1" requirement, because the product of no numbers is 1, thus the prime factorization of 1 is the unique product that has no factors at all.

      --
      The Tao of math: The numbers you can count are not the real numbers.
  14. Why did you do this? You hate America?? by 140Mandak262Jamuna · · Score: 2

    Now, next time Iran fakes out a missile launch test and claims it has tested some 53 rockets and shows pictures, it is going to be impossible to detect the cut/paste jet plumes.

    --
    sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
    1. Re:Why did you do this? You hate America?? by Anonymous Coward · · Score: 0

      Been done before. Crowds of Anonymous?
      He's really just one guy in a mask with Photoshop and some math.

  15. I DEMAND SLASHDOT ANSWER MY QUESTION by hellop2 · · Score: 0

    Question: Do cicadas come every 17 years, or do they come every year?

    Having lived in the Deep South for 5 years I seem to remember cicadas coming every year. Wikipedia says there are "broods" and there's 2500 different species. So, was I seeing a different species every year, or did I just see a different brood every year? I think I saw 2 different species.

    --
    How many more years will slashdot have an off-by-one error on your Score in your profile?
    1. Re:I DEMAND SLASHDOT ANSWER MY QUESTION by hellop2 · · Score: 1

      Because I can't figure out the answer to this question! And whenever someone asserts that they only come every 17 years, it drives me crazy!

      --
      How many more years will slashdot have an off-by-one error on your Score in your profile?
    2. Re:I DEMAND SLASHDOT ANSWER MY QUESTION by Anonymous Coward · · Score: 0

      They actually emerge every year, its just certain cycles have predominantly more emergence than others.I find them every year crawling out to split their casings and fly away.

    3. Re:I DEMAND SLASHDOT ANSWER MY QUESTION by mrxak · · Score: 1

      Remember also that there's multiple species on differing cycles.

    4. Re:I DEMAND SLASHDOT ANSWER MY QUESTION by psithurism · · Score: 1

      Do cicadas come every 17 years, or do they come every year?
      Answer: Depends on the species.
      Better Answer: Catch cicadas for 13 years and have them all identified.
      Even Better: Raise a brood from each year's species and see how long they take to come out and mate.

  16. Is it a bad sign... by Hakubi_Washu · · Score: 1

    ...that my first thought was "Ah, someone has finally understood why Gödel numbering is clever..."?

    1. Re:Is it a bad sign... by NoSleepDemon · · Score: 1

      My immediate reaction was that this kind of stuff is taught in introductory CS lectures as Perlin Noise, I suppose web developers with their javascript don't need to learn real programming or the application of complex algorithms :)

    2. Re:Is it a bad sign... by Anonymous Coward · · Score: 0

      He might not have learned in introductory CS, but he has a practical application instead of yet another Perlin noise generator...

    3. Re:Is it a bad sign... by Anonymous Coward · · Score: 0

      What are you talking about? Perlin noise is interpolation between points on a pseudo-random lattice, it has nothing to do with prime numbers or sequences of anything.

  17. Re:Ow. That made my brain hurt. by _0xd0ad · · Score: 5, Informative

    The point isn't randomness, the point is unwanted harmonics in pseudo-random patterns. These unwanted harmonics cause regular repetitions in the pattern that make it seem predictable and non-random. Prime numbers are the basis by which a simple PRNG (pseudo-random number generator) generates seemingly-random data that doesn't repeat in any predictable manner. By overlapping two or more sequences with prime lengths, the length of the harmonic is maximized. That means the sequence goes longer before repeating itself. Sequences with non-prime lengths short-circuit the cycle.

    For instance, overlapping three sequences of length 7, 11, and 13 forms the following pattern:
    http://tinyurl.com/3wserj7

    At a glance, the pattern looks fairly random and non-repeating; however if you look more closely you see that the vertical bands of color are repeating very regularly within the pattern. But, since their periodicity is prime, the pattern as a whole doesn't appear to repeat itself. Using alpha and larger 2-dimensional tiles you can create even more complex and random-seeming patterns.

    The life cycle of cicadas is similar in that the overlapping cycles tend to cause a seemingly-random pattern of years with lots of cicadas and few cicadas, such that the life cycle of their predators is less likely to hit a bunch of good cicada years in a row and seriously harm the population of them.

  18. I hate numbers by Anonymous Coward · · Score: 0

    ... there's too many of them.

  19. goddamit, you've broken reality again! by Thud457 · · Score: 1

    You got truthiness in my mathematics!
    This will not do. Oh no, no, no, no, no.

    --

    the preceding comment is my own and in no way reflects the opinion of the Joint Chiefs of Staff

  20. Congratulations... by NoSleepDemon · · Score: 0

    ...Are in order for the web developer community; they've discovered Perlin Noise! Aww bless! Meanwhile, game developers everywhere have been using this technique to generate anything from planetary landscapes to entire galaxies for a while now. Baby steps guys.

    1. Re:Congratulations... by _0xd0ad · · Score: 5, Informative

      This is very much not like Perlin noise, because Perlin noise uses octaves (doubles in frequency). Octaves are harmonic with each other by definition. This uses primes, specifically to cause the harmonics to occur as far apart as possible. Using octaves in this way would cause very repetitive-seeming patterns because the maximum size of your pattern would be defined as the size of your largest sequence, and all of the shorter sequences would tile into it in a neat checkerboard.

      Perlin noise requires infinite sequences of pseudo-random numbers and would be extremely ill-suited to using short repeating sequences. This is specifically designed to minimize the length of the sequences you use without causing obvious repetitions in the pattern by using sequences of prime length (since your "sequence" is a PNG, if it's too large it takes a long time to load).

    2. Re:Congratulations... by Anonymous Coward · · Score: 0

      Exactly. If anyone has mod points, mod parent up!

    3. Re:Congratulations... by NoSleepDemon · · Score: 1

      He's using pseudo random number generation to place images in a way that does not appear to repeat, this is pretty much exactly what Perlin Noise does, the way he composites images together is also similar to how one composites different layers of noise. The link I had in my OP also includes a specific section about NOT having each new octave be double the frequency of the last, specifically because you will get the standing wave like effect you mention. It's certainly a novel approach.

    4. Re:Congratulations... by _0xd0ad · · Score: 1

      Still, the key difference between this and Perlin noise is that this is formed by using short repeating patterns whereas Perlin noise relies upon an infinite pseudo-random number generator that shouldn't ever appear to repeat itself.

      The pseudo-random number generation, in this case, is in the x,y offsets of the tiles, not in the data contained in the tiles themselves - the tiles themselves are static PNGs. It's basically very similar to a simple linear congruential generator determining where the data on the tiles ends up.

  21. We were taught that 1 is a prime by queenb**ch · · Score: 1

    While it is isn't correct, I do recall being told in school that one is a prime because it is only divisble by itself.

    --
    HDGary secures my bank :/
  22. this is so obvious by Anonymous Coward · · Score: 0

    I've been using primes as max-mount-count for my ext3 filesystems to avoid checking them all at the same time for years

  23. Whatever happened to fractals? by DrVomact · · Score: 2

    Cool, but aren't we all supposed to be using fractals to generate realistic-looking virtual worlds and such by now? I mean, that's what I thought when I read that Scientific American article back in the 80s, and wrote a C program that ran for two weeks on my Compaq to create a picture of a Mandelbrot set. What was really funny was that the Compaq screen was grey scale...

    --
    Great men are almost always bad men--Lord Acton's Corollary
    1. Re:Whatever happened to fractals? by trb · · Score: 1

      This person is generating nice repeating patterns (like pleated curtains) with random alterations, using a small number of small image files and a small amount of computation to generate random numbers which guide the placement of those image files. Doing this with fractals would require computation that is orders of magnitude more costly.

    2. Re:Whatever happened to fractals? by DrVomact · · Score: 1

      This person is generating nice repeating patterns (like pleated curtains) with random alterations, using a small number of small image files and a small amount of computation to generate random numbers which guide the placement of those image files. Doing this with fractals would require computation that is orders of magnitude more costly.

      Yeeesss...I know. There I go, being elliptical again. It was a joke...albeit I was trying to draw attention to an underlying question. I sometimes wonder about predictions that were made back in [the day] that seem to have pretty much evaporated. The whole definition of what a fractal is always struck me as somewhat lacking in rigor. The popular science press of the late 80s and early 90s was full of talk about fractals, and one of the suggested applications was indeed to computationally generate super-realistic alien or imaginary landscapes. Now that computational power is cheap (compared to the 80s--oh my poor 8088 Compaq!), do any of the big animation studios use fractals to generate "random" landscapes? Does anybody use them in any sort of graphics applications?

      --
      Great men are almost always bad men--Lord Acton's Corollary
    3. Re:Whatever happened to fractals? by trb · · Score: 1

      I don't know what happened to fractals (in landscape image generation). I remember the "the Genesis effect" from back before the turn of the century. There's a wikipedia artcile on factal landscapes, but I don't know what's up with that these days.

    4. Re:Whatever happened to fractals? by Anonymous Coward · · Score: 0

      Lookup "SpeedTree", its been around for about 10 years now and a bunch of games use it [It generates realistic looking trees using fractals obviously].

    5. Re:Whatever happened to fractals? by Skywolfblue · · Score: 1

      do any of the big animation studios use fractals to generate "random" landscapes? Does anybody use them in any sort of graphics applications?

      I'm not really sure what the "big studios" use, but fractals are used quite a bit in 3D graphics apps. As an example of a program that hinges/is based around fractals: Terragen: http://www.planetside.co.uk/terragen/productmain.shtml Big Studios have a lot better apps then that, but the same process of using fractals for displacement and textures is in those programs as well.

    6. Re:Whatever happened to fractals? by Anonymous Coward · · Score: 0

      I have not checked, but I guess that fractals are not that far from what this guy is doing, in a mathematical way. Note how, each prime number tile has a period of its own, and how the intersection of two have a new period that contains the initial ones, at a larger scale. The same applies every time you add a new prime. Doesn't it sound like fractals to you?
      Interesting is that this very principle is what powers hash functions, and cryptography.

    7. Re:Whatever happened to fractals? by Anonymous Coward · · Score: 0

      A Mandelbrot set isn't intrinsically coloured, and so viewing it in grey scale is quite acceptable if not as aesthetically pleasing.

    8. Re:Whatever happened to fractals? by _0xd0ad · · Score: 1

      I suspect he meant monochrome, which is still an acceptable way of viewing the Mandelbrot set. Points are either in the Mandelbrot set or they are not in it.

      However there is also the intrinsic difficulty of determining that any given point is not in the set, which is normally represented as variation in the point's brightness or color. (If you fail to determine that a given point is not in the set, the algorithm eventually terminates under the assumption that it is.)

  24. Re:Ow. That made my brain hurt. by Anonymous Coward · · Score: 0

    Your type of comment is the reason /. is off my bookmarks. Here some guy come up with something positive, inspirational and beautiful, but no, it has to be dead, lifeless, boring and utterly correct. BS comments and BS perspectives for keeping alive your pet dogmas and paradigms.

  25. Re:Ow. That made my brain hurt. by blair1q · · Score: 0

    Thing is, I do understand it, which is why I know it's wrong.

    I'm not "one of those guys who tries to prove how smart they are by attempting to find fault with the article." I am smart. I found fault with the article. Several faults, upon review.

    Not being smart when complaining about my complaining being not smart makes you a hypocrite, and doesn't reduce my smartitude one bit.

  26. Re:Ow. That made my brain hurt. by JordanL · · Score: 3, Insightful

    You somehow simultaneously displayed a lack of understanding for the mechanisms of evolution (mutation and natural selection), and obliviousness to the point of the mathematics being discussed: using prime numbers to reduce periodicty of a given set of cycles.

    Also, your third and fourth paragraphs display utter ignorance of biology.

    Why are you even here? This article was very well articulated, and more important, useful, unlike your reply.

  27. Re:Ow. That made my brain hurt. by blair1q · · Score: 0

    The last time I discovered an "unwanted harmonic in pseudo-random patterns" I found that if you combine the return values from rand(3) in a certain way there's a consistent pattern to the final bit. But only in a certain way. You can't detect that periodicity just by doing a discrete fourier transform on its outputs.

    Yes, a PRNG, particularly an LCRNG, depends inexorably on the lack of common factors in its coefficients. But that's an aside to what this article is implying (though if he'd gone any further he might have derived an LCRNG from his degenerate use of prime numbers; one with a strikingly low periodicity, but then he says the words "degenerate example" and I'm okay with it as an example, and reminded of Martin Gardner and Jearl Walker teaching us all how such things work back when SciAm was worth the paper it was printed on).

    The fact is, using rand(3) produces a lot less periodicity than using the same 3 numbers in various combinations. And, as I said, the latter eliminates accidental periodic subpatterns that would make the output look more natural. Once you're getting to the point where your tiling algorithm is more complex than just "move right N places and place another copy of the tile" you might as well use the standard library you're given instead of reinventing the wheel (or the Monotonic Random Walk in this case).

  28. Why prime? Any irrational numbers should be fine. by gblackwo · · Score: 0

    It makes no more sense to me to use prime numbers as opposed to pi or anything else that will give you irrational numbers.

  29. Re:Ow. That made my brain hurt. by spun · · Score: 2

    No, you are simply wrong, as I quite clearly demonstrated, which is why you were modded down and I was modded up. So let me try to explain it in the very simple terms you need.

    Again, birds did not evolve a boom/bust cycle. They can not pick it through evolution, it is not up to them, it is up to their predators and food sources. As the article clearly explains, a prime number cycle for cicadas ensures that only ONE predator boom/bust cycle will match up with theirs, and natural predator/prey cycles are not ever that long. Here, all you demonstrate is a complete lack of understanding of evolution and ecology.

    You also have quite clearly either not read, or not understood the article. More importantly, you appear to not have even looked at the pictures. By overlapping patterns in prime cycles, a complex pattern is built up that does not appear repetitive to the eye. It was clearly demonstrated in the pictures, in case you are illiterate.

    Curtains ARE nature, everything is. Hanging curtains create a natural, complex pattern of folds. A standard repeating background does not have those same complex patterns.

    When you say "random things look random because they are random." you clearly demonstrate again that you have not read the article. Are curtains random? If you generated a 'random' curtain texture and tiled it, would it still appear random? No! It would not be seamless. But if you generated the tile using prime numbers, you could tile it and not see obvious seams.

    As I explained, they are not using prime numbers to mimic randomness, they are using them to create tiles that appear seamless. You total fucking idiot.

    When you claim "Fifth, nature does cyclical rather handily; not everything need be random to look natural." you AGAIN clearly demonstrate your total lack of comprehension about the article. They are not trying to create "random" you microencephalic retard, they trying to create background patterns that can be repeated across a page without appearing to be repeating tiles. You utter cretin.

    Now fuck off and let the smart people talk. I'm done with you, you're dismissed from class.

    --
    - None can love freedom heartily, but good men; the rest love not freedom, but license. -- John Milton
  30. Re:Ow. That made my brain hurt. by blair1q · · Score: 0

    If this site isn't bookmarked, how did you get here?

    No, he doesn't have to be "utterly correct". But being somewhere inside the ballpark on his basic premises would be a decent thing.

    His attempt to make this look "positive, inspirational and beautiful" by falsely linking the reproductive cycles of a living thing to his webpage-background generator clanked. That's too bad. But, as it turns out, he clanked all over the page, so maybe it was only natural.

    We've all seen capable examples of the nature-as-inspiration-for-mathematical-discovery trope (Hofstadter, Myers, Burke, Dewdney, etc. made a great genre out of them). Generally they're logical in themselves, and that's a beautiful thing. But when they're illogical it's not a beautiful thing, it's a self-conscious attempt to look like the people who can do it properly, or a failure to realize that the form is not the substance.

    Have fun not reading /. I hear it's almost as enlightening as reading /.

  31. Re:Ow. That made my brain hurt. by blair1q · · Score: 0

    Now you're just trolling.

    You demonstrated nothing, you merely claimed something, and you were wrong about that.

    I didn't say birds evolved into a boom/bust cycle. They evolved to survive boom/bust cycles, not to depend on them. It's irrelevant to them whether cicadas all appear on the same period or have mutually-prime periods of reproduction. And vice-versa. I also didn't say anything about whether the cycles were predator/prey-based or not. You're just making up things you didn't read in what I wrote.

    When you find a nice set of pleated velvet curtains growing in the forest, then you can say they're natural. Otherwise you're playing childish semantic games with the word "natural".

    Seamlessness of joining tiles does not rely on primeness. It only relies on having the same depth and slope of the curtain's fold on either side of the tile. What happens between those boundary conditions doesn't change that, no matter what you base the rest of the tile on.

    They absolutely are using prime numbers to mimic randomness. They say so. Their goal is "when you notice a distinctive feature—for instance, a knot in some woodgrain—repeating at regular intervals, it really breaks the illusion of organic randomness. Maybe we borrow some ideas from cicadas to break that pattern?" Their illogical deduction about the cicadas and randomness aside, they use that to mimic the randomness they seek in their tiling. They could just use a random-number generator and not conflate cicadas' relative-prime cycles with randomness.

    Frankly, I can't see anything you got right. So maybe when you realize you're not teaching a class so much as mouthing off from the corner with a dunce cap on, you'll apologize to the rest of us.

  32. Re:Ow. That made my brain hurt. by blair1q · · Score: 0

    Wait. I forgot one thing:

    Yes, I got modded down and you got modded up.

    I got modded up for being "insightful", down for being "overrated", and up for being "redundant", meaning I wasn't the only one who recognized something was wrong with the article.

    You got modded up by people who agreed with your assessment of my post, which is not proof that anything was wrong with my post, and couldn't be, because there was nothing wrong with my post.

    So if you somehow intended your observation about the mod points to mean you're right and I'm wrong, you still didn't get anything right.

    There. All better. Now go play.

  33. Re:Ow. That made my brain hurt. by spun · · Score: 1

    Me: +5 Insightful.
    You: -1 Redundant.
    So..... why do YOU think you were modded down, and I was modded up, hmmm, asshole?

    Don't be pedantic about the meaning of the word natural. You know as well as I and everyone else here what the author meant. You look like a prick when you argue semantics.

    If you read the article, you would understand that the appearance of seamlessness can be achieved through overlapping prime-number repetition of patterns, as demonstrated by the photos. The point being, these images are meant to be tiled. The idea is NOT to use a random process to generate a non-repeating texture to cover the entire background. The idea is to create a small texture that can be tiled to cover a background without appearing to repeat. Do you simply not understand why a random process will fail? No, don't answer that, it was rhetorical, I KNOW you don't get it, you SAID as much.

    Using prime numbers, the assure that visible components of a pattern, like the knot, do not repeat. It is not trying to achieve "random." Again, you are arguing semantics without understanding meaning. You argue the meaning of individual words taken out of context. You clearly do not understand what the article is trying to demonstrate.

    Now fuck off, I said you were dismissed, that means I am done with you. Buh bye. Good day, sir. Respond all you like, your comments will be ignored by me, and most likely modded down some more by readers who DO understand what the article was saying. So please, by all means, respond, get modded down, and lose karma, hopefully to the point where you post at -1 and people don't have to even notice your existence.

    In short,
    Me: +5 insightful.
    You: -1 redundant.
    'nuff said. But maybe you could tell yourself a nice make-believe story about why all the mean people like me and hate you. Then you could continue to believe you are intelligent, despite all the evidence to the contrary.

    --
    - None can love freedom heartily, but good men; the rest love not freedom, but license. -- John Milton
  34. Re:Why prime? Any irrational numbers should be fin by curril · · Score: 2

    Well, the images do have to be an integer number of pixels wide, but if the ratio between lengths approximated an irrational number you would expect long periods. Even relatively prime numbers would work. Tiles of length 7, 15, and 16 won't repeat for 1,680 pixels. Basically, if you want to create a nice, non-repetitive pattern of overlayed tiles, make certain that the smallest common multiple for all of the tile sizes is larger than your expected screen width.

  35. Re:Ow. That made my brain hurt. by Anonymous Coward · · Score: 0

    Hi, one of your moderator's here.

    Just FYI, once you get enough karma to actually get mod points, you will find that there is no moderation for "wrong" or "horribly wrong". That's why you got "overrated". The other negative options besides "overrated" are "off topic", "flamebait", and "troll". You were on topic, weren't really flaming, and I didn't think you were trolling. I just think you aren't very bright.

  36. Re:Ow. That made my brain hurt. by blair1q · · Score: 0

    Hi, no, you're not one of my moderators, unless you took the trouble to go to another IP address and log in under a different login then check the AC box. The system isn't stupid enough to let you moderate and then post because you clicked the AC box.

    I don't doubt someone disagreed with me, but that's all they did. Even if they thought I was wrong doesn't mean I'm wrong, and to think so is to fall prey to the Fallacy of Appeal to Popularity. Doubly so, since "Overrated" was only one of three mod votes I got, and doesn't even therefore count as the popular choice.

    If it was you who clicked "Overrated" and you thought I was wrong, you were wrong. If it wasn't you, then you get to sit there munching on your wasted life while I enjoy being right again.

  37. Re:Ow. That made my brain hurt. by Anonymous Coward · · Score: 0

    Yes, yes I am.

    I happen to have two computers here on my desk, and didn't want to undo my moderation by posting on the first one.

    Which is how I just modded your post offtopic because it's getting pretty far afield from the topic.

    Not bright at all.

  38. Re:prime number theorem? by Anonymous Coward · · Score: 0

    This is not the prime number theorem, this is the fundamental theorem of arithmetic. There's only 2 millennia worth of mathematics between the two :).

  39. Well... by Oxford_Comma_Lover · · Score: 1

    Chrome functions fine with it?

    On the one hand, that's good to know...

    On the other hand, isn't having to switch to chrome to make it reliable kinda... not-very-open-sourcey? (If you'll pardon the lack of English construction in that psuedosentence, and in this fragment.)

    --
    -- IANAL, this isn't legal advice, and definitely isn't legal advice for you. Also, Squee!
    1. Re:Well... by Ancantus · · Score: 1

      It doesn't matter, I use Chrome and I get the bugs all the time as well (Anonymous works but comment/link clicking is still buggy as hell). Its a problem with the site, not any specific browser.

      --
      Violence is the last refuge of the incompetent. -- Isaac Asimov
  40. ffs by kreyszig · · Score: 1

    hmm. I am surprised by the way people seem to be impressed by this. I though a few more /.ers would have written a hash function before.

  41. Really? by Anonymous Coward · · Score: 0

    How the feck can this be considered news? The use of prime numbers have been used this way for ages (encryption and RNG to name the two most obvious).

  42. Re:Ow. That made my brain hurt. by _0xd0ad · · Score: 1

    Once you're getting to the point where your tiling algorithm is more complex than just "move right N places and place another copy of the tile" you might as well use the standard library you're given instead of reinventing the wheel (or the Monotonic Random Walk in this case).

    If you wanted to generate your backgrounds on <canvas> elements with Javascript, sure, you could come up with something better using the built-in pseudo-random number generator. However, this is pretty good for a dumb, tiling CSS background pattern with a fairly large logical size but made up of relatively small elements.

  43. Re:Why prime? Any irrational numbers should be fin by shis-ka-bob · · Score: 1

    The images in question are bitmaps. Even on slashdot, they have integers for width and height. If you want to generalize, generalize to coprime, as other have noted.

    --
    Think global, act loco
  44. Re:Ow. That made my brain hurt. by mjbkinx · · Score: 1

    As it turned out, flamebait would have been more fitting. Or it could be a particularly perfidious troll. Overrated was correct in any case.

  45. Re:Ow. That made my brain hurt. by blair1q · · Score: 1

    So now you have three computers on your desk? because you modded it Overrated first, then posted, then modded it offtopic, that makes three.

    Being a cheater indicates you have no respect for the facts, as well as no acquaintance with them.

  46. Re:Ow. That made my brain hurt. by blair1q · · Score: 1

    Dude wrote a mess of code when a call to rand() would have done him solid. And then bragged about it.

    Ow.

  47. Re:Ow. That made my brain hurt. by _0xd0ad · · Score: 1

    A mess of code? Did you even look at it? It was 3 static PNG images, and a CSS rule that looked like "background:url(image1.png),url(image2.png),url(image3.png);". Tiling the images was all done automatically by the browser.

  48. Re:Ow. That made my brain hurt. by Anonymous Coward · · Score: 0

    I'm not him, but who's to say that he moderated it more than once? That would require him to have 3 different accounts with mod points too, anyway. And all you have to do to post anonymously in a discussion you've already moderated in is use a different browser that you aren't logged in on.

  49. Joke by hawkfish · · Score: 1

    Q: How do you tell a mathematician, a physicist and an engineer apart with one question?

    A: Ask them "Are all the odd numbers above 2 prime?"

    Mathematician: Well, 3 is prime, 5 is prime, 7 is prime, 9 is not prime, so NO.

    Physicist: Well, 3 is prime, 5 is prime, 7 is prime, 9 is not prime, but that is just experimental error.

    Engineer: Well, 3 is prime, 5 is prime, 7 is prime, 9 is prime, 11 is prime...

    (My father was an engineer, my brother is a physicist and I was a mathematician at one point, so this turned into a family joke!)

    --
    You will not drink with us, but you would taste our steel? - Walter Matthau, The Pirates
  50. Re:Ow. That made my brain hurt. by blair1q · · Score: 1

    I'm pretty sure that doesn't work, or just deleting a cookie would work. I may give it a try later. But he did say he'd moderated it more than once. Unless he was just lying.

  51. Re:Ow. That made my brain hurt. by blair1q · · Score: 1

    How does putting up 3 images repeatedly forestall repetition?

  52. Re:Ow. That made my brain hurt. by _0xd0ad · · Score: 1

    Go up and click the tinyurl link I posted and see if you understand what I mean. The period of the pattern is the least common multiple of the dimensions of all 3 images, and if the dimensions of the images are prime, their LCM is relatively large.

  53. Re:Ow. That made my brain hurt. by Anonymous Coward · · Score: 0

    He said he moderated one of your posts overrated and the other post offtopic. I don't see where he said he'd moderated more than once on the same post. And he was moderating from one computer and posting from a different computer.

    I also recall hearing someone claim that the user agent is significant, so just deleting the cookie might not be adequate. I do know that I've moderated from Firefox and then posted anonymously from IE and after refreshing the page in Firefox it didn't appear that the moderation had been removed.