{{newin|[[0.9.0]]|090|type=function}}
Generates a Simplex or Perlin noise value in 1-4 dimensions. The return value will always be the same, given the same arguments.

[http://en.wikipedia.org/wiki/Simplex_noise Simplex noise] is closely related to [http://en.wikipedia.org/wiki/Perlin_noise Perlin noise]. It is widely used for procedural content generation.

There are many [http://libnoise.sourceforge.net/noisegen/ webpages] which discuss Perlin and Simplex noise in detail.

{{notice|The return value might be constant if only integer arguments are used. Avoid solely passing in integers, to get varying return values.}}
== Function ==
Generates Simplex noise from 1 dimension.
=== Synopsis ===
<source lang="lua">
value = love.math.noise( x )
</source>
=== Arguments ===
{{param|number|x|The number used to generate the noise value.}}
=== Returns ===
{{param|number|value|The noise value in the range of [0, 1].}}
== Function ==
Generates Simplex noise from 2 dimensions.
=== Synopsis ===
<source lang="lua">
value = love.math.noise( x, y )
</source>
=== Arguments ===
{{param|number|x|The first value of the 2-dimensional vector used to generate the noise value.}}
{{param|number|y|The second value of the 2-dimensional vector used to generate the noise value.}}
=== Returns ===
{{param|number|value|The noise value in the range of [0, 1].}}
== Function ==
Generates Perlin noise (Simplex noise in version [[0.9.2]] and older) from 3 dimensions.
=== Synopsis ===
<source lang="lua">
value = love.math.noise( x, y, z )
</source>
=== Arguments ===
{{param|number|x|The first value of the 3-dimensional vector used to generate the noise value.}}
{{param|number|y|The second value of the 3-dimensional vector used to generate the noise value.}}
{{param|number|z|The third value of the 3-dimensional vector used to generate the noise value.}}
=== Returns ===
{{param|number|value|The noise value in the range of [0, 1].}}
== Function ==
Generates Perlin noise (Simplex noise in version [[0.9.2]] and older) from 4 dimensions.
=== Synopsis ===
<source lang="lua">
value = love.math.noise( x, y, z, w )
</source>
=== Arguments ===
{{param|number|x|The first value of the 4-dimensional vector used to generate the noise value.}}
{{param|number|y|The second value of the 4-dimensional vector used to generate the noise value.}}
{{param|number|z|The third value of the 4-dimensional vector used to generate the noise value.}}
{{param|number|w|The fourth value of the 4-dimensional vector used to generate the noise value.}}
=== Returns ===
{{param|number|value|The noise value in the range of [0, 1].}}

== Examples ==
Fills a two-dimensional grid with simplex noise each time a key is pressed.
<source lang="lua">
local grid = {}

function love.draw()
    for x = 1, #grid do
        for y = 1, #grid[x] do
            local f = 1 * grid[x][y]
            love.graphics.setColor( f, f, f, 1 )
            love.graphics.rectangle( 'fill', x * 8, y * 8, 7, 7 )
            love.graphics.setColor( 1, 1, 1, 1 )
        end
    end
end

-- Fill each pixel in our grid with simplex noise.
local function noise()
    for x = 1, 60 do
        for y = 1, 60 do
            grid[x] = grid[x] or {}
            grid[x][y] = love.math.noise( x + love.math.random(), y + love.math.random() )
        end
    end
end

function love.keypressed()
    noise()
end
</source>

== See Also ==
* [[parent::love.math]]
[[Category:Functions]]
{{#set:Description=Generates a Simplex noise value in 1-4 dimensions.}}
== Other Languages ==
{{i18n|love.math.noise}}