Hash Function

Description

A hash function is any function that can be used to map digital data of arbitrary size to digital data of fixed size, with slight differences in input data producing very big differences in output data. The output is called a hash value.

Hash functions are particularly interesting for procedural generation for their ability to produce pseudorandom numbers. Unlike Pseudo Random Number Generators, hash function create a random number solely based on an input, with no dependency on previous queries.

Not all hash functions are well suited for procedural generation, as they may either not have sufficiently random distribution, or be unnecessarily expensive, but there are some that are very well suited.

Code Example

External Links

Hash Function - Wikipedia article on Hash Functions.
Primer on Repeatable Random Numbers - Article on random number generators and random hash functions by Rune Skovbo Johansen.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License