Skip to content

atl/sm/noise

import "atl/sm/noise"

sm.noise: noise functions.

func Perlin(x, y float64, seed int) float64

2D Perlin noise.

func Octave(x, y float64, octaves, seed int) float64

2D Perlin noise summed over several octaves.

func Simplex1(x float64) float64
func Simplex2(x, y float64) float64
func Simplex3(x, y, z float64) float64

1D, 2D and 3D simplex noise.

func IntNoise(x, y float64, seed int) int
func FloatNoise(x, y float64, seed int) float64

Deterministic integer and float noise per point: the same inputs give the same output.

func RandomRange(a, b float64) float64

A random number between a and b.

func RandomNormal(mean, deviation float64) float64

A random number from a normal distribution.

func GunSpread(direction sm.Vec3, degrees float64) sm.Vec3

A direction randomly spread within degrees of direction.