Skip to content

Instantly share code, notes, and snippets.

@sevvie
Created October 14, 2012 20:50
Show Gist options
  • Save sevvie/3889785 to your computer and use it in GitHub Desktop.
Save sevvie/3889785 to your computer and use it in GitHub Desktop.
package mapgen
type PerlinNoisePRNG struct {
seed, octaves int
persistence, frequency, amplitude float64
}
func (prng *PerlinNoisePRNG) NoiseAt(x, y float64) float64 {
n := int(y) * 47 + int(x) + prng.seed
n = (n << 13) ^ n
ni := float64( (n * (n*n * 60493 + 19990303) + 1376312589) & 0x7fffffff )
return (1.0 - ni / 1073741824)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment