How does this perlin noise generator work?

Hello, i have recently created a Perlin Noise Generator and I want to know how math.noise() works.
Basically, the code below creates this:

local X = 75
local Z = 75
local grid = {}

for x = 1, X do
grid[x] = {}

for z = 1, Z do
	grid[x][z] = math.noise(x/20, z/20) * 100 -- How does this work?


for x = 1, X do
for z = 1, Z do
local yPos = grid[x][z]

	local part ="Part")
	part.Anchored = true

	if yPos < -3 then
		part.Material = Enum.Material.Sand
		part.BrickColor ="Cool yellow")
		part.Material = Enum.Material.Grass
		part.BrickColor ="Bright green")
	part.Position =*5, yPos, z*5)
	part.Size =, 30, 5)
	part.Parent = workspace


local water =“Part”)
water.Anchored = true
water.Size =, 30, Z5)
water.Position =*5)/2, -5, ((Z+1)*5)/2)
water.CanCollide = false
water.Transparency = .5
water.BrickColor =“Electric blue”)
water.Parent = workspace

If you know how perlin noise works, please reply.

Ive played around with perlin noise a while back but if you wanna know how math.noise() works make sure to check out the following link:

Basically what it means is math.noise generates numbers between -.5 and .5, not randomly, but using a procedural algorithm. it is super useful.

1 Like

Facinating, thank you! I have been wondering this for some time now.