Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In 1982 (several years before DOOM), Ken Perlin invented an algorithm meant to produce random numbers that more closely resembled a human's interpretation of "random" numbers (versus those generated by computers). Humans, it seemed, tended to choose a lot of different numbers, whereas random numbers from a CPU actually produced lots of repeating sequences. His work in the field was vital to developing the first 3D shaded graphics in a Hollywood film (Tron), for which he won an Academy Award for Technical Achievement.

Perlin Noise is still used to this day for generating clouds, natural-looking terrains, and other textures that are pleasing to the human brain.

Python implementation: https://github.com/caseman/noise/blob/master/perlin.py

Excellent talk by its creator: http://www.noisemachine.com/talk1/



I remember many years ago the iTunes player had to include an option for "humanizing" the randomness of their shuffle play (or whatever they called it).

Turns out that good randomness didn't seem random to people. They might hear three songs in a row from the same album and think "that's not right, it should be random!" Of course, humans often have a different idea of what "random" is.



What I expect from a music player is to play all my songs in random order, such that once a song has been played, it is not picked again until all songs have been played.

There is a difference between randomly picking an element from a list and reordering a list in a random order. This is not a matter of how random really are the random numbers.


Hence the term "shuffle" rather than "random" I suppose


I've found that a nice randomness of songs is to play your library by song tilte, alphabetically.


One of the classic radio stations in Chicago does this a couple times a year -- they play their entire catalog A-Z. I agree that it does come out pretty nice.


I used to get annoyed by car stereos randomizing CD tracks rather than shuffling. My Honda did once play the same song three times in a row.


And not just textures or terrain. Apply Perlin noise to a vector field and you create smoothly random motion, which can be used to simulate things like air currents.


Good point! Here's two OpenGL animations across multiple 1-dimensional vertices:

Perlin- https://i.imgur.com/ROww6bw.gif Random- https://i.imgur.com/EurTdaZ.gif


I animated these tentacles using Perlin noise: http://www.youtube.com/watch?v=RMwJXP8EOU4

(By manipulating the available variables in a Bezier curve.)


Is your account name homage?


I'd wager it's just random


'perlin' is a brand new account, and therefore apparently created for this article, so I was wondering if it might in fact be Ken Perlin himself.

But of course homage accounts are more common these days.


Why is the python implementation so much more complicated than the doom one? Are they supposed to be the same?


Seriously? The DOOM prng is just a table with a pointer stepping through the values. The Perlin code generates values based on the Perlin algorithm.

The values in the DOOM table could have been generated by Carmack throwing a dice many times for all we know and just tabulated the results.


To be fair, the key insight to the DOOM prng is that it was used frequently enough for hundreds of mundane events that a player didn't realize (or care) that it wasn't very random at all. There was never a "guess the number" game. A good write-up is here: http://jmtd.net/log/deterministic_doom/


Yes, that is totally correct.

But that does not make the question why the DOOM solution is so much smaller than the perlin noise code more valid. It is simply not the same thing. One is a table of set of generated data, the other a generator of data that can be tabulated.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: