Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Today, I got into an argument about the term "procedural generation".

My point was that its different from "classic" random generation in that procedural generation is based on a more mathematical, fractal-based, algorithm leading to a more "realistic" distribution and the usual randomness of most languages are based on a pseudo-random-number generator, leading to an "unrealistic", in a way, ugly, distribution. This discussion was made with a heightmap in mind.

The discussion left me somehow unconvinced about my own arguments though, so, is there more to it? Or am I the one who is, in fact, simply wrong?

share|improve this question
Are you asking about different ways to generate realistic-looking random objects such as terrain, trees, etc.? –  Jay Elston Dec 20 '12 at 1:03
Mostly yes, we're using a heightmap to distribute "trees" over a particular area (2D-grid), ie creating a more or less dense forest. And there the discussion started. –  U-No-Poo Dec 20 '12 at 7:22
You are in error. I recommend reading Discrete-Event Simulation by Leemis & Park. It is an expensive textbook, so you may want to see if it is available through your library. Chapters 2 and 3 should set you straight. amazon.com/Discrete-Event-Simulation-Lawrence-M-Leemis/dp/… –  Tangurena Dec 20 '12 at 15:16

5 Answers 5

up vote 7 down vote accepted

I think you're wrong. Procedural is not the opposite of random; procedural is the opposite of handmade.

its different from "classic" random generation in the way that procedural is based on a more mathematical, fractal based, algorithm leading to a more "realistic" distribution and the usual randomness of most languages are based on a pseudo-random-number generator, leading to an "unrealistic", in a way, ugly, distribution.

Both of the schemes you are describing here are procedural. The first is arguably better, more sophisticated, but both:

  • take a small input (the seed);
  • use that seed and nothing else, along with an algorithmic process, to produce the output

Now, it might well be that when people talk about procedural generation, what they usually talk about are complicated generation schemes based on carefully refined algorithms - but they are still random in the sense that the input is a random variate.

The "'unrealistic', in a way, ugly, distribution[s]" you mention? Those are procedural too - just using a relatively unsophisticated procedural generation scheme.

share|improve this answer
Well, I never claimed procedural and random generation are opposites (if it sounds like that, sorry, not intended), but this answer actually got me (and my colleague) back on track, sophistication was the word that the discussion yesterday was surely missing. Thanks. :) –  U-No-Poo Dec 20 '12 at 7:28

First off, everything a computer does is by definition pseudo-random, unless it is actually connected to a radioactivity counting device or something similar. It doesn't matter whether you use fractal iterative systems, linear equations or whatever - the same seed will produce the same sequence (and that is often good, e.g. for creating rliable test suites).

Certainly there are good and bad algorithms for producing random sequences by computer, but the definition of what is "realistic" (much less "ugly") is by no means uncontested. As a very basic example, you would naively expect a random series of binary digits to have equals amounts of 0 and 1 values, but actually this definition would make every other item completely predictable, and the resulting sequence very, very predictable.

Actual random sequences of binary digits tend to have roughly equal amounts of 0s and 1s, and the ratio tends to approach 0.5 as the sequence grows, but the absolute number of 0s and 1s is actually more likely to become more unequal over time. (Getting exactly 500,000 0s and 500,000 1s from a million random digits is quite improbable.) So you see that the definition of "random" is rather more complicated than just "unpredictable" or "evenly distributed", and there is no complete consensus on what the definition should be or which properties of sequences are actually needed for a given task. I'm not certain which of those properties can be improved with fractal generators over the standard linear congruential generators, but I expect more knowledgeable people will post some.

share|improve this answer

Let me add to the discussion that the difference between 'random' and 'deterministic' is, in the real world, a pure matter of subjective perception. - Like you said: Some solutions produce "ugly" results while others don't.

In the world I'm referring to, the actual difference between 'random' and non-random is basically only, if the human observer is able to recognize a pattern in the generated output, like some recurring scheme or some other aspect that makes him aware what the output might probably look like in one of the next iterations. The ability to recognize a given pattern depends of course heavily on the oberver's context: Some people may fail to see the pattern behind the sequence 2, 3, 5, 7, 9, 11, 13, 17, 19, 23, 29, while other's are likely to quickly detect it.

Therefor, every cheap off-the-shelf PRNG will easily make the observer/user believe its output is really random. - Or, put in another way: Whenever the observer fails to recognize the cause-consequence (or input-output) correlation in a system his observations will appear as purely random to him.

As I see it, the question then becomes:

  1. How complex would the algorithm need to be to 'deceive' the (expected) observer? and
  2. How to shape the output in a way that, while remaining perceived basically random, creates the desired 'realistic' or 'non-ugly' perception. - This may also be about aesthetics. Fractal algorithms often are good at this, because their output structurally resembles the observer's impression of the real world.
share|improve this answer

procedural generation means there is a seed which defines all output and no matter how many times you regenerate with the same seed you get the same output each time, which you see used for example in minecraft and dwarf fortress

true random generation takes extra external entropy to add to the initial seed so each time it runs you get a different output

it is important to note that both approaches can result in both good and bad generation

common psuedo random generators used for this are linear congruential generators and mercenne twisters, either of which can be sufficient if used correctly

for example minecraft uses a LCG (as in java's stock standard Random implementation) for it's map generation

share|improve this answer

The main difference between procedural generation and pseudo-random generation is that numbers generated by a procedural generation algorithm (such as a fractal) are supposed to have some preset relations whereas pseudo-random numbers are supposed to simulate truly random processes.

Note -- this answer is based on Wikipedia's definition of procedural generation

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.